【发布时间】:2012-06-25 15:06:08
【问题描述】:
我想遍历 NSString 并在每个具有特定标准的单词上调用自定义函数(例如,“有 2 个 'L's”)。我想知道最好的方法是什么。我应该使用查找/替换模式吗?块?
-(NSString *)convert:(NSString *)wordToConvert{
/// This I have already written
Return finalWord;
}
-(NSString *) method:(NSString *) sentenceContainingWords{
// match every word that meets the criteria (for example the 2Ls) and replace it with what convert: does.
}
【问题讨论】:
标签: objective-c string cocoa cocoa-touch nsstring