public class TestBr {
public static void main(String[] args) {
String string = "珍贵的舒服打开\r\n哈客户端看安费\r\n";
String result = string.replaceAll("\\r\\n","
");//成功!String result1 = string.replace("\\r\\n","
");//没有替换成功String result2 = string.replace("\r\n","
");//成功!System.out.println("result="+result);
System.out.println("result1="+result1);
System.out.println("result2="+result2);
}}
运行结果: