java中用反斜杠替换斜杠时间:2022-12-06 14:45:32代码: public class TestReplaceAll { public static void main(String[] args) { String f = new String("d://folder//test.txt"); System.out.println(f.replaceAll("////", "/")); } } 结果: //d:/folder/test.txt