String str = "\"; str = str.replaceAll("\\","|\\"); System.out.println(str);
参考 https://www.cnblogs.com/xdp-gacl/p/3912784.html