I have a string like this:
mysz = \"name=john age=13 year=2001\";
I want to remove the whitespaces in the string. I tried trim()
replaceAll("\\s","")
\w = Anything that is a word character
\W = Anything that isn't a word character (including punctuation etc)
\s = Anything that is a space character (including space, tab characters etc)
\S = Anything that isn't a space character (including both letters and numbers, as well as punctuation etc)
(Edit: As pointed out, you need to escape the backslash if you want \s to reach the regex engine, resulting in \\s.)