[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: Re: [lang] New StringUtils method - defaultIfEmpty
From: Stephen Colebourne <scolebourne () btopenworld ! com>
Date: 2005-03-31 22:52:03
Message-ID: 424C7F13.1010405 () btopenworld ! com
[Download RAW message or body]
It depends really on how you perceive the function, ie. which group of
methods does it belong to.
I perceive this as an extension to the default* methods, as its just
deaulting based on another condition.
trimToDefault isn't wrong, but its not where *I* would look for the method.
Stephen
Gary Gregory wrote:
> It sounds OK but there might be a different (better?) way.
>
> We now have trimToEmpty and trimToNull methods. What about a
> trimToDefault method?
>
> Just a thought.
>
> Gary
>
> -----Original Message-----
> From: Stephen Colebourne [mailto:scolebourne@btopenworld.com]
> Sent: Wednesday, March 30, 2005 2:29 PM
> To: Jakarta Commons Developers List
> Subject: [lang] New StringUtils method - defaultIfEmpty
>
> 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
>
>
>
> ---------------------------------------------------------------------
> 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic