How to split a string by special character “\” in Gradle
-
27-12-2019 - |
Question
How to split a string by a special character in gradle
ie.
String strDomain = "domain\my name"
and catch
"domain","my name"
Solution
Use regular Java/Groovy:
def strDomain = "domain\\my name"
println strDomain.split("\\\\")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow