String temp = "a\nbc"; String temp1; String temp2; temp1 = temp.replace("\n","\\n"); temp2 = temp.replaceAll("\n","\\n"); System.out.println(temp); System.out.println(temp1); System.out.println(temp2);
本文共 314 字,大约阅读时间需要 1 分钟。
String temp = "a\nbc"; String temp1; String temp2; temp1 = temp.replace("\n","\\n"); temp2 = temp.replaceAll("\n","\\n"); System.out.println(temp); System.out.println(temp1); System.out.println(temp2);
转载于:https://www.cnblogs.com/chonghaojie/p/8794585.html