File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
Java in General
which string function to remove whitespace between two strings
Joined: Feb 06, 2009
May 03, 2009 04:35:31
i want to remove spaces between 2 strings .
the trim function in
will remove only leading and trailing whitespaces.
but is there any string function in
such that the for example
str=" javahorn forum"
i want to remove the whitespace between javahorn and forum such that it displays as
Joined: Oct 13, 2005
May 03, 2009 04:47:43
Look for the replace and replaceAll methods. You may require an understanding of
Joined: Feb 21, 2007
May 03, 2009 23:44:49
Using regular expressions might help you in long term.
But for quick getting quick results without spending too much resources in writing good regexes you can alternatively try Apache string util api at
for several string processing functions.
I agree. Here's the link:
subject: which string function to remove whitespace between two strings
Remove unwanted chars (new line,tab) in java
Removing specific character from the given String
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014