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" <[EMAIL PROTECTED]>
To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
> > Sent: Saturday, July 19, 2003 13:13
> > To: Jakarta Commons Developers List
> > Subject: Re: [lang] Proposal (2): isEmpty
> >
> > From: "Henri Yandell" <[EMAIL PROTECTED]>
> > > > 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to