String相关

1. componentsSeparatedByString 将字符串切割成数组

  NSString *a = [[NSString alloc] initWithString : @"狗,猪,苹果,小狗" ];

    NSArray *b = [a componentsSeparatedByString:@","];

    NSString *c = [b objectAtIndex:2];

    NSLog(@"   b的index是2的值为: %@", c);

输出为 苹果

原文地址:https://www.cnblogs.com/ITliufei/p/5734260.html