Re: Removing blanks spaces



Roy Gourgi wrote:
How would I remove spaces either trailing or following?

For example if I have a variable x = " 10" and I would like to remove
the 4 spaces before the 10 so that the variable x = "10".
Also if I again have a variable x = "10 " and I would like to remove
the 4 spaces after the 10 so that the variable x = "10".
And what if you have a variable x = " 10 " ?
I assume you want to remove all the spaces before *and* after the 10 so that
the variable is x = "10";

How would I do that?
String x = ....;
x = x.trim();

See the API docs at
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#trim()>

--
Thomas
.