开发者

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

I would like to do the following

[controller setMessageBody:[开发者_JAVA技巧NSString stringWithFormat:@"<strong>%@</strong> <br> <br> %@ <br><br> %@ <br><br> Sent From MyApp",self.articleTitle, self.articleDescription, self.articleURL] 
isHTML:YES];

on the last %@ I would like to do <a href="%@">Hello</a>

But I am not sure how to escape it properly?


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜