在Objective-C中,你可以使用NSArray的componentsSeparatedByString:方法来将字符串按字符分组
NSString *str = @"Hello World";
NSArray *charArray = [str componentsSeparatedByString:@" "];
for (NSString *charGroup in charArray) {
NSLog(@"%@", charGroup);
}
输出:(Hello,World)