You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <gg...@seagullsw.com> on 2003/07/20 20:12:16 UTC

RE: [lang] How should StringUtils.indexOfAny handle "" in search string?

The convention could perhaps also bracket template like things with
<i>template</i>, as in:

/**
  * Blah Blah <code>Foo.bar(<i>inputValue</i>);</code> Blah Blah.
  */

Gary

-----Original Message-----
From: Stephen Colebourne [mailto:scolebourne@btopenworld.com] 
Sent: Sunday, July 20, 2003 02:21
To: Jakarta Commons Developers List
Subject: Re: [lang] How should StringUtils.indexOfAny handle "" in search
string?

----- Original Message -----
From: "Phil Steitz" <ph...@steitz.com>
> Currently, StringUtils.indexOfAny(str, searchStrings) returns 0 if
> searchStrings contains "", but we return -1 if it contains null.  Is
> this the way we want it to work? We should add javadoc in any case.

I guess it has to be. String.indexOf("") returns 0. So this just matches
that behaviour.

> One more thing. I really like the examples in the javadoc, but in some
> cases they might be clearer/more complete if we used "*" to indicate
> *any* value (i.e., null, "", "  ", "abc", etc).  For example,
>
> StringUtils.indexOfAny(null, *) = -1
> StringUtils.indexOfAny(*, null) = -1

I think I'm OK with it. The downside is it involves learning a convention.
But I think its probably obvious enough. Any other views?

Stephen

> I am preparing a patch fixing a few small typos/omissions in the
> StringUtils javadoc.  Is it OK if I use this notation?
>
> Phil



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