Bilow Yuriy Bilow Yuriy - 1 year ago 98
Groovy Question

How to replace string in Groovy

I have some string like


I want by means of Groovy to convert string to


I try to perform it with command

Change_1 = Log_file_1.replaceAll('\','/');

It doesn't convert this string

Answer Source

You need to escape the backslash \:

println yourString.replace("\\", "/")