Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy: Replace / in Path with \

How would you replace / with \ in Groovy? So that "//10.1.1.1/temp/test" becomes "\\10.1.1.1\temp\test".

"//10.1.1.1/temp/test".replaceAll(/'\\/'/,'\\') <-- ? doesn't work

Does anyone have an idea?

Thanks for any answer.

like image 584
Booyeoo Avatar asked Dec 22 '22 10:12

Booyeoo


1 Answers

Look at this "//10.1.1.1/temp/test".replaceAll("/","\\\\"). "\\\\" makes a single backslash.

like image 168
emstol Avatar answered Dec 31 '22 19:12

emstol