How can I escape slashes and quotes in Objective-C?

前端 未结 1 1639
不思量自难忘°
不思量自难忘° 2021-01-28 17:45

I would like to do the following

[controller setMessageBody:[NSString stringWithFormat:@\"%@ 

%@
<
相关标签:
1条回答
  • 2021-01-28 18:34

    Just use

    @"....<a href=\"%%@\">Hello</a>..."
    

    if you put it in the format, or use

    @"<a href=\"%@\">Hello</a>"
    

    if you include it using %@ in the format string. The %@ is only interpreted in the first argument of the stringWithFormat: method here.

    0 讨论(0)
提交回复
热议问题