commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject [lang] New StringUtils method - defaultIfEmpty
Date Wed, 30 Mar 2005 22:28:38 GMT
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?

Stephen

---------------------------------------------------------------------
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