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:(NSCharacterSet *)set intoString:(NSString **)value;
|
- (BOOL)scanDecimal:(NSDecimal *)dcm;
|
- (BOOL)isAtEnd;
|
- (BOOL)scanDouble:(double *)value;
|
- (BOOL)scanFloat:(float *)value;
|
- (BOOL)scanHexInt:(unsigned *)value;
|
- (BOOL)scanInt:(int *)value;
|
- (BOOL)scanLongLong:(long long *)value;
|
- (BOOL)scanString:(NSString *)string intoString:(NSString **)value;
|
- (BOOL)scanUpToCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)value;
|
- (BOOL)scanUpToString:(NSString *)string intoString:(NSString **)value;
|
- (NSString *)string;
|
// Methods Implementing NSCopying |
- (id)copyWithZone:(NSZone *)zone;
|