码迷,mamicode.com
首页 > 编程语言 > 详细

Java替换字符串中的\r\n

时间:2019-10-23 18:00:26      阅读:449      评论:0      收藏:0      [点我收藏+]

标签:static   ring   eal   system   字符串   replace   ace   acea   string   

public static void main(String[] args) {
String str = "啊\r\n啊";
str = str.replaceAll("(\r\n|\n)", "<br/>");
System.out.println(str);
}

 

亲测可用

Java替换字符串中的\r\n

标签:static   ring   eal   system   字符串   replace   ace   acea   string   

原文地址:https://www.cnblogs.com/niudaxianren/p/11727649.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!