Strip Leading and Trailing Spaces From Java String -



Strip Leading and Trailing Spaces From Java String -

possible duplicate: trim whitespace string?

is there convenience method strip leading or trailing spaces java string?

something like:

string mystring = " maintain "; string stripppedstring = mystring.strip(); system.out.println("no spaces:" + strippedstring);

result:

no spaces:keep

mystring.replace(" ","") replace space between maintain , this.

thanks

you can seek trim() method.

string newstring = oldstring.trim();

take @ javadocs

java string replace

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -