字符串分割数组

不含有分隔符
NSString * str = @"hello";
NSMutableArray * arr = [NSMutableArray arrayWithCapacity:0];
    // 遍历字符串,按字符来遍历。每个字符将通过block参数中的substring传出
    [str enumerateSubstringsInRange:NSMakeRange(0, str.length) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
        [arr addObject:substring];     
    }];
NSLog(@"arr = %@", arr);
含分隔符
NSArray  *array = [str componentsSeparatedByString:@","];--分隔符
将array数组转换为string字符串
NSString *str = [array componentsJoinedByString:@","];  ,分隔符

推荐阅读更多精彩内容