macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

setCharactersToBeSkipped:

スキップしたい文字列をセットします
-(void)setCharactersToBeSkipped:(NSCharacterSet *)skipSet:

解説

スキップしたい文字列をセットします。

返り値

( void )

なし

引数

( NSCharacterSet * )skipSet

文字セット

クラス

NSScanner

Instance Methods

使用可能

10.0

参照

- charactersToBeSkipped
+ whitespaceCharacterSet (NSCharacterSet)

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
    //NSScannerを作る
    NSScanner *scanString = [[NSScanner alloc]
                initWithString:@"300"];
    NSMutableString *str;//文字を作る
    NSDecimalNumber *dNum = [[[NSDecimalNumber alloc] autorelease] initWithString:@"300"];
    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];

    [myOutlet setStringValue:str];

NSLog([[scanString locale] description]);
}

@end