我有一个应用程序,其中有一个 NSString 的 NSArray。问题是这些 NSStrings 在我需要删除的每个单词之间都有“_”。不幸的是,我不知道该怎么做。
这是我正在使用的代码:
for (NSString *word in wordList) {
[word stringByReplacingOccurrencesOfString:@"_" withString:@" "];
[wordTypeList addObject:word];
}
其中 wordTypeList 是一个 NSMutableArray。不幸的是,我的输出是数组的内容,没有任何变化(即下划线没有被删除)。我做错了什么?