Best practice to remove whitespaces and charactersin a string with multiple words?

1
Hi guys   I have multiple words in a string (for example: First- and Lastname, Street/Zip/City), whereby I want to:   1) remove all the whitespaces 2) remove the special characters as "/" and "-" 3) lowercase all   How can i do this the best?
asked
1 answers
12

Hi Enzo,

I would use a regex in a combination with toLowerCase for this

toLowerCase(replaceAll($Name,'\W++',''))

where $Name is the attribute that you want to sanitize and '\W++' matches one or more non-word characters. For more information see https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

Hope this helps,

Andrej

answered