How would you replace / with \ in Groovy? So "//10.1.1.1/temp/test" becomes "\\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(/'\\/'/,'\\') <-? does not work
"//10.1.1.1/temp/test".replaceAll(/'\\/'/,'\\')
Does anyone have any ideas?
Thanks for any answer.
Look at this "//10.1.1.1/temp/test".replaceAll("/","\\\\") . "\\\\" does a backslash.
"//10.1.1.1/temp/test".replaceAll("/","\\\\")
"\\\\"
Please check it
String path = 'D:/folder1/folder2/yourfile' String result = path.replaceAll( "/","\\");
Finally, you get a result like
'D:\folder1\folder2\yourfile'