commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [lang] Proposal (2): isEmpty
Date Sun, 20 Jul 2003 00:57:43 GMT
isWhitespace() still exists, but returns false for null. This is compliant
with the other character test methods such as isAlpha().

Empty checks:
 isEmpty() - "" or null
 isBlank() - whitespace only, "" or null

Character checks:
 isWhitespace() - whitespace or ""
 isAlpha() - alpha or ""
etc.

Thus, using isBlank avoids changing the functionality of the 1.0
isWhitespace.

Stephen

----- Original Message -----
From: "Henri Yandell" <bayard@generationjava.com>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Sunday, July 20, 2003 1:37 AM
Subject: RE: [lang] Proposal (2): isEmpty


>
> Ack. It would help if isWhitespace existed. I thought it did as a part of
> our isAlpha etc methods. I need to check my assumptions more.
>
> I still think isWhitespace is a bit better as it matches the
> naming/functionality of Character.isWhitespace (as char's cannot be null)
> and the StringUtils general functionality of trying to do the
> obvious/quietest thing on null, but it's not that important.
>
> Hen
>
> On Sat, 19 Jul 2003, Gary Gregory wrote:
>
> > I like the blank version as it is more expressive.
> >
> > Does this version isBlank trim?
> >
> > Gary
> >
> > -----Original Message-----
> > From: Stephen Colebourne [mailto:scolebourne@btopenworld.com]
> > Sent: Saturday, July 19, 2003 13:13
> > To: Jakarta Commons Developers List
> > Subject: Re: [lang] Proposal (2): isEmpty
> >
> > From: "Henri Yandell" <bayard@generationjava.com>
> > > > It isn't. My preference is now for
> > > >
> > > > isEmpty() - "" or null
> > > > isBlank() - whitespace only, "" or null
> > >
> > > Could just tell people to do isWhitespace && isEmpty  ? :)
> >
> > I feel  isBlank() is more expressive than  isWhitespace(). It just feels
> > more inclusive of null and empty.
> >
> > if (isNotBlank()) {
> >   ...process data
> > }
> > OR
> > if (isNotWhitespace()) {
> >   ...process data
> > }
> >
> > Then again isWhitespace follows our naming definitions.
> >
> > ---
> > > > isEmptyTrimmed() - trim() then "" or null
> > >
> > > I'm not sure there's any need for this. I wonder how much of the chars
> > > less than 32 count as whitespace? But it seems that isWhitespace is
for
> > > most people's usage a superset of isEmptyTrimmed.
> >
> > Yeh, I'm happy to miss it out.
> >
> > ---
> > > > (plus isNotEmpty, isNotBlank, isEmptyNN, isBlankNN)
> > >
> > > Still hard to decide how far to go with all these. isEmptyNN is a
> > > single-atom method. isNotEmpty just replaces a ! sign etc etc.
> >
> > The Nots are very useful for these cases as they are so frequent.
> >
> > ---
> > > Does anyone actually want isEmptyNN, or is it just that people are
unhappy
> > > with the null-handling in StringUtils? In which case I think the NN is
the
> > > wrong solution, we need to be thinking about an ability to create a
> > > StringUtils with a strategy or having an underlying hidden class and 3
> > > facade's for the different strategies. All 3.0.
> >
> > +1. Leave out NN for now. Its a bit of a hack.
> >
> > Stephen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


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


Mime
View raw message