Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你会如何/用\Groovy 替换?这样 "//10.1.1.1/temp/test"就变成了"\\10.1.1.1\temp\test"。
/
\
"//10.1.1.1/temp/test"
"\\10.1.1.1\temp\test"
"//10.1.1.1/temp/test".replaceAll(/'\\/'/,'\\')<-- ? 不工作
"//10.1.1.1/temp/test".replaceAll(/'\\/'/,'\\')
有人有想法吗?
感谢您的任何回答。
看看这个"//10.1.1.1/temp/test".replaceAll("/","\\\\")。"\\\\"做一个反斜杠。
"//10.1.1.1/temp/test".replaceAll("/","\\\\")
"\\\\"
请检查这个
String path = 'D:/folder1/folder2/yourfile' String result = path.replaceAll( "/","\\");
最后你得到像
'D:\folder1\folder2\yourfile'