如何在目标c中的字符串中包含""

Lew*_*wis 1 string objective-c comma

可能重复:
如何在字符串中转义双引号?

如何在字符串中包含""并阻止它结束字符串?我有一串html但不能定义元素,因为我不能使用""的任何帮助吗?

pmd*_*mdj 5

使用反斜杠转义引号,如下所示:

@"A string with \"quotes\" around the word \"quotes\"."
Run Code Online (Sandbox Code Playgroud)

如果你用NSLog()它打印,它将输出为:

A string with "quotes" around the word "quotes".
Run Code Online (Sandbox Code Playgroud)

Objective-C继承了它从C转义的字符串文字,这里列出了一些更多的C字符串转义码.