commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian P. MOMON (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LANG-1169) Add a StringUtils method to compare a string to multiple strings
Date Sun, 27 Sep 2015 14:47:04 GMT

    [ https://issues.apache.org/jira/browse/LANG-1169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14909750#comment-14909750
] 

Christian P. MOMON edited comment on LANG-1169 at 9/27/15 2:46 PM:
-------------------------------------------------------------------

Hi. I support the request but I needed some changes to have a similar behavior with other
functions (startsWithAny and endsWithAny):

# do not throw exception if parameter are null or empty: if (ArrayUtils.isEmpty(searchStrings))
{
            return false;
        }
 
# use parameter names like in startsWithAny and endsWithAny: endsWithAny(CharSequence string,
CharSequence... searchStrings)

Regards.




was (Author: cpm):
Hi. I support the request but I needed some changes to have a similar behavior with other
functions (startsWithAny and endsWithAny):

# do not throw exception if parameter are null or empty: if (isEmpty(string) || ArrayUtils.isEmpty(searchStrings))
{
            return false;
        }
 
# use parameter names like in startsWithAny and endsWithAny: endsWithAny(CharSequence string,
CharSequence... searchStrings)

Regards.



> Add a StringUtils method to compare a string to multiple strings
> ----------------------------------------------------------------
>
>                 Key: LANG-1169
>                 URL: https://issues.apache.org/jira/browse/LANG-1169
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Arman Sharif
>            Priority: Minor
>
> It would be nice to have a method that compares a string to multiple strings as follows:
> {code}
> StringUtils.equalsAny("baz", "for", "bar", "baz"); // true
> StringUtils.equalsAny("xyz", "for", "bar", "baz"); // false
> {code}
> I created a PR if there is an interest in adding this to the library:
> https://github.com/apache/commons-lang/pull/109



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message