Re: Removing blanks spaces
- From: Thomas Fritsch <i.dont.like.spam@xxxxxxxxxxx>
- Date: Wed, 27 Jun 2007 17:03:24 GMT
Roy Gourgi wrote:
How would I remove spaces either trailing or following?And what if you have a variable x = " 10 " ?
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".
I assume you want to remove all the spaces before *and* after the 10 so that
the variable is x = "10";
String x = ....;
How would I do that?
x = x.trim();
See the API docs at
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#trim()>
--
Thomas
.
- References:
- Removing blanks spaces
- From: Roy Gourgi
- Removing blanks spaces
- Prev by Date: Re: Newbie: -classpath option of java does not load the content of the jar file
- Next by Date: Re: Newbie: -classpath option of java does not load the content of the jar file
- Previous by thread: Removing blanks spaces
- Next by thread: Re: Removing blanks spaces
- Index(es):