commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject RE: [lang] StringUtils.strip
Date Fri, 19 Jul 2002 04:12:45 GMT

I've made the strip code match the original intended javadoc. Was a
worrying simple fix :) I didn't do the "ab" sequence version I suggested,
as I'm happy with the view that it's not going to be highly desirable.

Hen

On Wed, 17 Jul 2002, Berin Loritsch wrote:

> I disagree.  When you look at java.util.StringTokenizer, when
> you have multiple characters in the delimiter, it means that
> any one of those characters splits a token.
>
> You just need to document it explicitly that it strips all
> characters until it encounters the first character that is not
> in the delimiter list.
>
> What real use would there be if we only striped out the token
> "ab"?  I can do that by calling m_str.SubString( "ab".length,
> m_str.length() );
> The only thing I can think of is to add another parameter that
> is a boolean to flag wether the algorithm respects the sequence
> of characters in the delimiter or not.
>
> In that case, we should have three methods:
>
> // strip whitespace
> StringUtils.stripStart(String word)
> {
>    StringUtils.stripStart( word, " \b\t\r\n\l" );
> }
>
> // strip all characters in the delimiters
> StringUtils.stripStart(String word, String delimiters)
> {
>     StringUtils.stripStart( word, delimiters, false );
> }
>
> StringUtils.stripStart(String word, String delimiters, boolean
> respectSequence)
> {
>     // .....
> }
>
> As the user needs to be more specific about the requirements of the
> stripStart/stripEnd methods, they have something that handles it.
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message