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()
In java we can do following operation:
String pattern="[\\s]";
String replace="";
part="name=john age=13 year=2001";
Pattern p=Pattern.compile(pattern);
Matcher m=p.matcher(part);
part=m.replaceAll(replace);
System.out.println(part);
for this you need to import following packages to your program:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
i hope it will help you.