1个回答
展开全部
int main(int argc, const char * argv[])
{
@autoreleasepool {
//@"aaabbccccdd"输出成@"3a2b4c2d
NSString *str =@"0go08o32d";
NSMutableString *mstr = [NSMutableString stringWithCapacity:0];
for (int i=0; i<str.length; i++) {
char a = [str characterAtIndex:i];
if (a>='a'&&a<='z') {
a=a-32;
[mstr appendFormat:@"%c",a];
}
}
NSLog(@"%@",mstr);
}
return 0;
}
{
@autoreleasepool {
//@"aaabbccccdd"输出成@"3a2b4c2d
NSString *str =@"0go08o32d";
NSMutableString *mstr = [NSMutableString stringWithCapacity:0];
for (int i=0; i<str.length; i++) {
char a = [str characterAtIndex:i];
if (a>='a'&&a<='z') {
a=a-32;
[mstr appendFormat:@"%c",a];
}
}
NSLog(@"%@",mstr);
}
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询