如何在 Objective-C 中转义斜杠和引号?
我想对
[controller setMessageBody:[NSString stringWithFormat:@"<strong>%@</strong> <br> <br> %@ <br><br> %@ <br><br> Sent From MyApp",self.articleTitle, self.articleDescription, self.articleURL]
isHTML:YES];
最后一个 %@ 执行以下操作 我想做 Hello
但我不确定如何正确转义它?
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>
But I am not sure how to escape it properly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需使用
如果将其放入格式中,则
,或者如果在格式字符串中使用
%@
包含它,则使用。%@
仅在stringWithFormat:
方法的第一个参数中进行解释。Just use
if you put it in the format, or use
if you include it using
%@
in the format string. The%@
is only interpreted in the first argument of thestringWithFormat:
method here.