【发布时间】:2011-11-16 10:03:13
【问题描述】:
假设我有一个包含控制代码“\f3”的字符串(是的,它是 RTF)。我想用另一个字符串替换那个控制代码。目前我正在使用[mutableString replaceOccurrencesOfString:@"\f3" withString:@"replacement string" options:0 range:NSMakeRange(0, [mutableString length])];
这很好用,但是有时代码可以是“\f4”甚至是“\f12”。如何替换这些字符串?我可以为每个使用replaceOccurrencesOfString,但更好的方法是使用通配符,因为它可以是任何数字。
【问题讨论】: