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
Post a Comment