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/09/04 20:22:42 UTC

[lang] StringUtils.ordinalIndexOf() and INDEX_NOT_FOUND

Hello All,

I've added StringUtils.ordinalIndexOf() and introduced a new constant
StringUtils.INDEX_NOT_FOUND = -1. Currently, only ordinalIndexOf uses this
constant. 

I would like to get a fell if folks think that replacing (where
appropriate), the -1 magic number usage in StringUtils with this constant is
a good idea or refactoring gone wild.

Thanks,
Gary

RE: [lang] StringUtils.ordinalIndexOf() and INDEX_NOT_FOUND

Posted by Steven Caswell <st...@mungoknotwise.com>.
Unless you want to be as nerdy as I am and do it so that checkstyle doesn't
complain.


Steven Caswell
steve@mungoknotwise.com
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: Stephen Colebourne [mailto:scolebourne@btopenworld.com] 
> Sent: Thursday, September 04, 2003 6:22 PM
> To: Jakarta Commons Developers List
> Subject: Re: [lang] StringUtils.ordinalIndexOf() and INDEX_NOT_FOUND 
> 
> 
> Personally I wouldn't use INDEX_NOT_FOUND, as -1 is so well known.
> 
> Stephen
> 
> ----- Original Message -----
> From: "Gary Gregory" <gg...@seagullsw.com>
> To: "'Jakarta Commons Developers List'" 
> <co...@jakarta.apache.org>
> Sent: Thursday, September 04, 2003 7:22 PM
> Subject: [lang] StringUtils.ordinalIndexOf() and INDEX_NOT_FOUND
> 
> 
> > Hello All,
> >
> > I've added StringUtils.ordinalIndexOf() and introduced a 
> new constant 
> > StringUtils.INDEX_NOT_FOUND = -1. Currently, only 
> ordinalIndexOf uses 
> > this constant.
> >
> > I would like to get a fell if folks think that replacing (where 
> > appropriate), the -1 magic number usage in StringUtils with this 
> > constant
> is
> > a good idea or refactoring gone wild.
> >
> > Thanks,
> > Gary
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 
> 



Re: [lang] StringUtils.ordinalIndexOf() and INDEX_NOT_FOUND

Posted by Stephen Colebourne <sc...@btopenworld.com>.
Personally I wouldn't use INDEX_NOT_FOUND, as -1 is so well known.

Stephen

----- Original Message -----
From: "Gary Gregory" <gg...@seagullsw.com>
To: "'Jakarta Commons Developers List'" <co...@jakarta.apache.org>
Sent: Thursday, September 04, 2003 7:22 PM
Subject: [lang] StringUtils.ordinalIndexOf() and INDEX_NOT_FOUND


> Hello All,
>
> I've added StringUtils.ordinalIndexOf() and introduced a new constant
> StringUtils.INDEX_NOT_FOUND = -1. Currently, only ordinalIndexOf uses this
> constant.
>
> I would like to get a fell if folks think that replacing (where
> appropriate), the -1 magic number usage in StringUtils with this constant
is
> a good idea or refactoring gone wild.
>
> Thanks,
> Gary
>