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] New StringUtils method - defaultIfEmpty
Date Sun, 10 Apr 2005 23:26:15 GMT
defaultIfEmpty implemented
Stephen

Fredrik Westermarck wrote:
> Stephen Colebourne wrote:
> 
>> Currently we have two default methods, both of which default when the 
>> string parameter is null. At my job we just had need of a default if 
>> empty method:
>>
>> public String defaultIfEmpty(String str, String defaultString) {
>>  if (isEmpty(str)) {
>>   return defaultString;
>>  } else {
>>   return str;
>>  }
>> }
>>
>> Does this sound OK to add?
> 
> 
> Since what you describe is a rather common use case I'm +1.
> 
> /Fredrik Westermarck
> 
> 
> ---------------------------------------------------------------------
> 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