如何逃逸字符串如下所示。我使用下面的代码,但说
“未为打印预览类型定义方法unescape(String)”
字符串s= unescape(stringFromDatabase)
我从这个链接中看到了这个方法:
New Line character \n not displaying properly in textView Android
我想要“第1行\n行2\n行3\n行4\n第5行”字符串到下面但不工作
第1行
第2行
第3行
第4行
第5行
发布于 2011-07-12 09:40:08
你应该自己定义;-)。
你所指的线程的一个建议是
private String unescape(String description) {
return description.replaceAll("\\\\n", "\\\n");}
但当然,这取决于你试图做什么,这是否会起作用。
https://stackoverflow.com/questions/6661877
复制相似问题