charactersToBeSkipped
スキャナが無視する文字の文字セットを返します
解説
スキャナが無視する文字の文字セットを返します。
返り値
( NSCharacterSet * )
文字セット
引数
フレームワーク
Foundation
クラス
NSScanner
Instance Methods
使用可能
10.0
参照
- setCharactersToBeSkipped:
+ whitespaceAndNewlineCharacterSet (NSCharacterSet)
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //NSScannerを作る NSScanner *scanString = [[NSScanner alloc] initWithString:@"300"]; NSMutableString *str;//文字を作る NSDecimalNumber *dNum = [[NSDecimalNumber alloc] init]; NSDecimal dec = [dNum decimalValue]; //NSSCannerの文字列 NSLog([NSString stringWithFormat:@"string %@",[scanString string]]); if ([scanString scanDecimal:&dec]){ NSLog(@"scanDecimal YES"); }else{ NSLog(@"scanDecimal NO"); } NSLog([NSString stringWithFormat:@"location %d",[scanString scanLocation]]); [scanString setScanLocation: 1 ]; [scanString setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@"\"'"]]; [scanString scanUpToString:@"\n" intoString:&str]; NSLog([[scanString charactersToBeSkipped] description]); } @end