Name
NSScanner — Mac OS X 10.0
Synopsis
This class declares an API for objects that can interpret and convert
a string into individual number and string values. When you create a
scanner object, you assign it the string to scan. Scanner objects are
created with the method scannerWithString
:, or
initialized with initWithString
:. A
scanner
works by interpreting and converting string and number values based
on the scan message sent to the scanner object. For example, if the
method scanInt
: is invoked, the scanner will scan
through the string searching from the next available integer.
Scanning usually happens within a loop, until the entire string has
been scanned. Clients can test whether or not the scanner is at the
end of the string using the method isAtEnd
.
|
@interface NSScanner : NSObject <NSCopying>
|
// Convenience Constructors
|
+ (id)scannerWithString:(NSString *)string; |
// Initializers
|
- (id)initWithString:(NSString *)string; |
// Accessor Methods
|
- (void)setCaseSensitive:(BOOL)flag; |
- (BOOL)caseSensitive;
|
- (void)setScanLocation:(unsigned)pos; |
- (unsigned)scanLocation;
|
- (void)setCharactersToBeSkipped:(NSCharacterSet *)set; |
- (NSCharacterSet *)charactersToBeSkipped;
|
- (void)setLocale:(NSDictionary *)dict; |
- (NSDictionary *)locale;
|
// Class Methods
|
+ (id)localizedScannerWithString:(NSString *)string; |
// Instance Methods
|
- (BOOL)scanCharactersFromSet ... |
Get Cocoa in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.