做法使用 NSMutableString 的replaceOccurrencesOfString方法 下面例子,把字符串中的数字都替换做0 title=@"test123 test"; NSMutableString *mutableStr = [NSMutableString stringWithString:title]; [mutableStr replaceOccurrencesOfString:@"\\d+" withString:@"0" options:NSRegularExpressionSearch range:NSMakeRange(0, [mutableStr length])];