开发者

Problem using stringByReplacingOccurancesOfString in Objective-C [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

I'm having some problems working with NSStrings in Objective C... the code below returns a warning, sayin开发者_运维知识库g:

"'NSString' may not respond to '-stringByReplacingOccurancesOfString:withString:"

NSString* NewWord = [Word stringByReplacingOccurancesOfString:@"!" 
                                                   withString:@""];

What am I doing wrong? Any help is greatly appreciated - thanks


It's a spelling error. The method name is actually stringByReplacingOccurrencesOfString.


I find that the LLVM complier provides a better warning in this case:

warning: method '-stringByReplacingOccurancesOfString:withString:' not found (return type defaults to 'id')

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜