NSString *string = @"这是一个测试的字符串";
NSString *temp = nil;
for (int i = 0; i < [string length]; i ++) {
temp = [string substringWithRange:NSMakeRange(i, 1)];
NSLog(@"第%d个字是:%@",i,temp);
}

NSString *string = @"这是一个测试的字符串";
NSString *temp = nil;
for (int i = 0; i < [string length]; i ++) {
temp = [string substringWithRange:NSMakeRange(i, 1)];
NSLog(@"第%d个字是:%@",i,temp);
}
本文标题:获取字符串中的每一个字
本文链接:https://www.haomeiwen.com/subject/tyxtzttx.html
网友评论