Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
サーバーから受信した長い文字列をいくつかの部分文字列に分割したいと考えています。個別の文字は異なります。
メソッドのサンプル コード: componentsSeparatedByCharactersInSet はありますか? または、"A~B^C" を "A"、"B"、"C" に分割する簡単なコードをお願いできますか?
これを試して
NSString *str = @"A~B^C"; NSArray *arr = [str componentsSeparatedByCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"^~"]]; NSLog(@"%@", arr);