replaceCharactersInRange
NSString 替换字符串中某一位置的文字 replaceCharactersInRange
NSString 替换字符串中某一位置的文字
- (void)viewDidLoad
{
NSMutableString *a = [[NSMutableString alloc] initWithString:@"123456798"];
NSLog(@" \n a: %@ \n",a);
[a replaceCharactersInRange:NSMakeRange(1, 4) withString:@"love"];
NSLog(@" \n a: %@ \n",a);
[a release];
}
2011-07-06 09:49:05.523 Q[9513:207] a: 123456798
2011-07-06 09:49:05.524 Q[9513:207] a: 1love6798