我有一个字符串:
NSString *s = @"a+v+c+d";
其中 '+'
是分隔符。
我想将每个 a,b,c,d
存储在 array
中。如何在 Objective-C 中完成?
最佳答案
- (NSArray *)componentsSeparatedByString:(NSString *)separator
就是你要找的方法
NSArray *yourArray = [yourString componentsSeparatedByString:@"+"];
关于objective-c - 如何在 Objective-C 中找到分隔符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3574663/