NSString nslog显示“\\\<br/>”换行符 [英] NSString nslog revealing &quot;\n&quot; newline character

查看:431
本文介绍了NSString nslog显示“\\\<br/>”换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想记录一个NSString,但当我记录它,它不显示新的行字符
n。我怎么能这样做呢?感谢。

I want to log an NSString but when I log it, it doesn't show the new line character " n". How can I make it so it does? Thanks.

推荐答案

您可以先处理字符串,替换 \\\
\\\\

You can process the string first and replace all occurrences of \n with \\n

NSString *newString = [originalString stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];

这篇关于NSString nslog显示“\\\<br/>”换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆