Removing whitespace from strings in Groovy

You can use the replaceAll() function.

For your case:

replaceAll("\\s","")

where \s means any whitespace (such as a space character).

Leave a Comment