简单的正则表达式方法字符串替换

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

posted on 2013-03-22 15:49  流れ星ーー  阅读(143)  评论(0编辑  收藏  举报

导航