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

c# - Move local mssql database to webhosted MYSQL -

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -