代码:
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