commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Jonker <...@pobox.com>
Subject Re: StringUtils.isEmpty(), isNotEmpty() and stringsa with some spaces
Date Thu, 26 Jun 2003 01:10:43 GMT
In general, StringUtils seems to munge up the distinctions between null,
zero-length, and whitespace-only strings.  Obviously there is no concrete
definition of what "empty" means.  This makes the whole suite of related
methods hard to learn, IMO.

Personally, I think "empty" should mean "zero-length or whitespace-only",
but should not include null.  You can't really say that your box is empty if
you have no box at all.

Another appropriate term would be "blank".  Perhaps a way to fix all this
would be to deprecate the poorly-defined "empty" methods and replace them
with well-defined "blank" methods.

.T.


On 6/25/03 8:13 AM, scolebourne@btopenworld.com wrote:

> I would tend to agree that it is inconsistent. I can't remember if
> isNotEmpty() was in release 1.0. If it was then changing it makes me
> uncomfortable.
> 
> Stephen 
> 
>>  from:    =?ISO-8859-1?Q?Reinhard_N=E4gele?= <reinhard.naegele@mgm-edv.de>
>>  date:    Wed, 25 Jun 2003 11:02:57
>>  to:      commons-user@jakarta.apache.org
>>  subject: Re: StringUtils.isEmpty(), isNotEmpty() and stringsa with some
>> spaces
>> 
>> This behavior is specified in the JavaDocs. However, I also think this
>> is not really consistent. Any thoughts?
>> 
>> Reinhard
>> 
>> 
>> Dmitri Ilyin wrote:
>> 
>>> Hi,
>>> 
>>> if is use isEmpty() method of StringUtils with "   " (string with some
>>> spaces) and isNotEmpty() with the same string i get true from both methods,
>>> becouse isEmpty trims the parameter string and isNotEmpty doesn't.
>>> 
>>> I think it is not OK.
>>> 
>>> regards
>>> 
>>> Dmitri
>>> 
>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>> 
>>>  
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 

-- 

A patriot must always be ready to defend his country against its
government.  -Edward Abbey, naturalist and author (1927-1989)

    Defend our country!  Vote Howard Dean 2004
        http://www.DeanForAmerica.com/
        http://www.MoveOn.org/


Mime
View raw message