| Author |
which string function to remove whitespace between two strings
|
pavithra murthy
Ranch Hand
Joined: Feb 06, 2009
Posts: 53
|
|
hello ,
i want to remove spaces between 2 strings .
the trim function in string will remove only leading and trailing whitespaces.
but is there any string function in java such that the for example
str=" javahorn forum"
i want to remove the whitespace between javahorn and forum such that it displays as
str=" javahornforum"
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
|
Look for the replace and replaceAll methods. You may require an understanding of refular expressions.
|
 |
sridhar vedhanabatla
Greenhorn
Joined: Feb 21, 2007
Posts: 12
|
|
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 http://commons.apache.org/lang/apidocs/org/apache/commons/lang/StringUtils.html for several string processing functions.
|
 |
 |
|
|
subject: which string function to remove whitespace between two strings
|
|
|