NSMutableString * str= [[NSMutableString alloc]initWithCapacity:10]; [str setString:@"1234"];//设置一个字符串 [str appendString:@"aaaa"]; [str appendFormat:@"%d",27]; //拼接字符串 NSRange range= [str rangeOfString:@"aaa"];//快速取得一个字符串的范围 [str replaceCharactersInRange:range withString:@"ddggggg"];//替换一个范围的字符串 [str insertString:@"vvvv" atIndex:4];//插入一个字符串 [str deleteCharactersInRange:range];//删除一个范围的字符串