【发布时间】:2023-03-05 10:07:01
【问题描述】:
如何在字符串中包含 "" 并阻止它结束字符串?我有一个 html 字符串,但无法定义元素,因为我不能使用“”,请问有什么帮助吗?
【问题讨论】:
标签: objective-c string comma
如何在字符串中包含 "" 并阻止它结束字符串?我有一个 html 字符串,但无法定义元素,因为我不能使用“”,请问有什么帮助吗?
【问题讨论】:
标签: objective-c string comma
用反斜杠转义引号,如下所示:
@"A string with \"quotes\" around the word \"quotes\"."
如果你用NSLog()打印它,它会输出为:
A string with "quotes" around the word "quotes".
Objective-C 继承了它从 C 中转义的字符串文字,还有一些 C 字符串转义码 are listed here 等等。
【讨论】:
所以你想要一个字符串中的引号? 我想你想要这样的东西:
"string with quote: \" << the quote"
【讨论】: