I have some string like
C:\dev\deploy_test.log
I want by means of Groovy to convert string to
C:/dev/deploy_test.log
I try to perform it with command
Change_1 = Log_file_1.replaceAll('\','/');
It doesn't convert this string
Java, Scala, Kotlin, Python, and Gradle are the most popular alternatives and competitors to Groovy.
Groovy has added the minus() method to the String class. And because the minus() method is used by the - operator we can remove parts of a String with this operator. The argument can be a String or a regular expression Pattern. The first occurrence of the String or Pattern is then removed from the original String.
You need to escape the backslash \
:
println yourString.replace("\\", "/")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With