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);
}}
運行結(jié)果: