[英]How can I escape slashes and quotes in Objective-C?
I would like to do the following 我想做以下几点
[controller setMessageBody:[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>
我想在最后一个%@上
<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. %@
仅在此处的stringWithFormat:
方法的第一个参数中解释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.