如何删除NSString中的引号? [英] How can I remove quotes from an NSString?
本文介绍了如何删除NSString中的引号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从以下内容中删除引号:
I am trying to remove quotes from something like:
你好"
因此字符串就是:
你好
推荐答案
查看Apple的文档:
Check out Apple's docs:
您可能想要:
stringByReplacingOccurrencesOfString:withString:
返回一个新的字符串,在该字符串中,接收器中所有出现的目标字符串都被另一个给定的字符串替换.
Returns a new string in which all occurrences of a target string in the receiver are replaced by another given string.
- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
因此,类似这样的方法应该起作用:
So, something like this should work:
newString = [myString stringByReplacingOccurrencesOfString:@"\"" withString:@""];
这篇关于如何删除NSString中的引号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文