You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mike Zatko <mz...@boscovs.com> on 2004/05/04 22:49:34 UTC

[lang] StringUtils.strip

I have a problem with the strip method:

        String number = "610-926-6598";
        String newNumber = StringUtils.strip(number, "-");
        System.out.println("newNumber: '" + newNumber + "'");

Output:
newNumber: '610-926-6598'

According to the JavaDoc, this should strip out the hyphens but it does 
not. A matter of fact I cannot get it to strip anything.

http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringUtils.html#strip(java.lang.String,%20java.lang.String)

-- 

Michael H. Zatko
WebSphere Developer
Boscov's Information Services
Work: 610-929-7317
Home: 610-562-2407


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [lang] StringUtils.strip

Posted by Denis Haskin <De...@HaskinFerguson.net>.
 From the javadoc you so conveniently linked to:

"Strips any of a set of characters from the start and end of a String. "

Note *start* and *end*.

dwh


Mike Zatko wrote:

> I have a problem with the strip method:
>
>        String number = "610-926-6598";
>        String newNumber = StringUtils.strip(number, "-");
>        System.out.println("newNumber: '" + newNumber + "'");
>
> Output:
> newNumber: '610-926-6598'
>
> According to the JavaDoc, this should strip out the hyphens but it 
> does not. A matter of fact I cannot get it to strip anything.
>
> http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringUtils.html#strip(java.lang.String,%20java.lang.String) 
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org