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 -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -