将数组中小写替换成大写

import

int main(int argc, const char * argv[]) {
@autoreleasepool {
NSMutableArray *a=[NSMutableArray array ];
[a addObject:@"aaa"];
[a addObject:@"bbb"];
[a addObject:@"ccc"];
[a addObject:@"ddd"];
[a addObject:@"eee"];
for (NSObject *object in a ) {
NSLog(@"替换前数组对象:%@",object);
}
for (int i=0;i<[a count];i++){
NSString *s =[a objectAtIndex:i];
NSString *s1=[s uppercaseString];
[a replaceObjectAtIndex:i withObject:s1];
//[a replaceObjectAtIndex:i withObject:[a[i] uppercaseString]];
}
for (NSObject * object in a) {
NSLog(@"替换后数组对象:%@",object);
}
}
return 0;
}

你可能感兴趣的:(将数组中小写替换成大写)