[
https://issues.apache.org/jira/browse/LANG-974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pascal Schumacher closed LANG-974.
----------------------------------
Resolution: Won't Fix
Fix Version/s: (was: Review Patch)
I'm closing this as "Won't Fix" after reading the comments.
> New StringUtils Method defaultIfNotIn(String, String, String ...)
> -----------------------------------------------------------------
>
> Key: LANG-974
> URL: https://issues.apache.org/jira/browse/LANG-974
> Project: Commons Lang
> Issue Type: Wish
> Components: lang.*
> Affects Versions: 3.2.1
> Reporter: Stephan Knitelius
> Priority: Minor
>
> Example use case:
> If a Method expects values that should only consist of a certain set such as
> "0" and "1", and any Invalid String should be defaulted to "0".
> Possible Solution:
> {code}
> public static String defaultIfNotIn(final String str, final String
> defaultString, String... validStrings) {
> if (str == null) {
> return defaultString;
> }
> for (final String validString : validStrings) {
> if (validString.equals(str)) {
> return str;
> }
> }
> return defaultString;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)