NSMutableString *string = [NSMutableString stringWithFormat:@"age is %i.",28];
[string setString:@"123"];
[string appendString:@"456"];
[string appendFormat:@"age is %i.",29];
NSLog(@"afterAppend:%@",string);
[string setString:@"123456"];
NSRange range =[string rangeOfString:@"345"];
[string replaceCharactersInRange:range withString:@"abc"];
NSLog(@"afterreplace:%@",string);
时间: 2024-10-06 16:11:13