删除NSString中的双引号 [英] Remove double quotes from NSString
本文介绍了删除NSString中的双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从NSString中删除双引号.示例:
How do I remove double quotes from an NSString. Example:
//theMutableString: "Hello World"
[theMutableString replaceOccurrencesOfString:@"\"" withString:@"" options:NSCaseInsensitiveSearch range:(NSRange){0,[theMutableString length]}]
它似乎不起作用,也许是因为我不得不在replaceOccurrencesOfString中转义"?
It doesn't seem to work, maybe since I had to escape the " in the replaceOccurrencesOfString?
推荐答案
使用NSMakeRange
函数代替您的演员表.这样就可以了:
Use the NSMakeRange
function instead of your cast. This'll work:
[mString replaceOccurrencesOfString:@"\"" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mString length])];
这篇关于删除NSString中的双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文