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()
To remove spaces in your example, this is another way to do it:
String mysz = "name=john age=13 year=2001";
String[] test = mysz.split(" ");
mysz = String.join("", mysz);
What this does is it converts it into an array with the spaces being the separators, and then it combines the items in the array together without the spaces.
It works pretty well and is easy to understand.