import <Foundation/Foundation.h>
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;
}