如何在字符串中转义双引号? [英] How to escape double quotes in string?
本文介绍了如何在字符串中转义双引号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望双引号出现在以下字符串中,如下所示:
I'd like double quotes to appear within the following string so it looks like:
"hi there == "
这里是我使用的代码:
NSMutableString *s = [[NSMutableString alloc] init];
[s appendString:@""""];
[s appendString:@"hi there == ""\n\r"];
而是我只得到:
hi there ==
任何想法?
推荐答案
[s appendString:@"hi there == \"\n\r"];
\
- 这是标准C格式。
\"
is what is needed for "
- This is standard C formatting.
这篇关于如何在字符串中转义双引号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文