将得到的路径的单斜线替换为双斜线

String path = “E:\testFile\product”;
System.out.println("path是:"+path);
String newpath=path.replaceAll("\\\\","\\\\\\\\");

System.out.println("新的路径:"+newpath);

替换后输出之后的路径是:E:\\testFile\\product


本文出自 “java技术学习” 博客,转载请与作者联系!

你可能感兴趣的:(单斜线,双斜线)