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()
trim()
String a="string with multi spaces "; //or this String b= a.replaceAll("\\s+"," "); String c= a.replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ").replace(" "," ");
//it work fine with any spaces *don't forget space in sting b