1. componentsSeparatedByString 将字符串切割成数组
NSString *a = [[NSString alloc] initWithString : @"狗,猪,苹果,小狗" ];
NSArray *b = [a componentsSeparatedByString:@","];
NSString *c = [b objectAtIndex:2];
NSLog(@"\n b的index是2的值为: %@", c);
输出为 苹果
posted on 2016-08-03 20:04 请叫我飞戈 阅读(84) 评论(0) 编辑 收藏 举报