字符串转换为数组
NSMutableArray *arr = [[NSMutableArrayalloc]init];
NSString *str = @"abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i<str.length; i++) {
NSString *s = [str substringWithRange:NSMakeRange(i, 1)];
[arr addObject:s];
}
NSLog(@"%@",arr);
字符串按特定字符拆分为数组
NSString * fruits = @"apple,pair,banana,orange";
NSArray * array= [fruits componentsSeparatedByString:@","];
NSLog(@"%@",array);