commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LANG-742) [IgnoreCase] methods for ArrayUtils
Date Mon, 21 Oct 2013 19:35:46 GMT

     [ https://issues.apache.org/jira/browse/LANG-742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Henri Yandell updated LANG-742:
-------------------------------

    Fix Version/s: Review Patch

> [IgnoreCase] methods for ArrayUtils
> -----------------------------------
>
>                 Key: LANG-742
>                 URL: https://issues.apache.org/jira/browse/LANG-742
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Michael Lyons
>            Priority: Minor
>             Fix For: Review Patch
>
>         Attachments: StringArrayUtils.java, StringArrayUtilsTest.java
>
>
> This is a proposal for a feature addition.
> On several projects, I've needed to perform case insensitive manipulation on Arrays of
Strings. My original need was just a solution for containsIgnoreCase(String[], String) and
indexOfIgnoreCase(String[], String). In an effort to keep things simple, I created this class
which implements 8 [IgnoreCase] methods that could be a benefit to Commons Lang users.
> StringArrayUtils extends ArrayUtils, it provides case insensitive manipulation on an
Array of Strings.
> The new methods provided in the class are:
> containsIgnoreCase(String[] array, String stringToFind)
> indexOfIgnoreCase(String[] array, String stringToFind)
> indexOfIgnoreCase(String[] array, String stringToFind, int startIndex)
> isEqualsIgnoreCase(String[] array1, String[] array2)
> lastIndexOfIgnoreCase(String[] array, String stringToFind)
> lastIndexOfIgnoreCase(String[] array, String stringToFind, int startIndex)
> removeElementIgnoreCase(String[] array, String element)
> removeElementsIgnoreCase(String[] array, String... values)
> These eight methods cover the functional pattern provided in ArrayUtils. Any comparison
in ArrayUtils based on obj1.equals(obj2) now has an equivalent str1.equalsIgnoreCase(str2)
in StringArrayUtils.
> I've included a test case and have made efforts to match your coding convention and style.
Thanks in advance for your time and consideration. I'd be happy to follow up with any changes
or edits if you think this is something that might be included in a future version of Commons
Lang.
> ...Mike
> Ps. I understand that handling a special case for the String's equalsIgnoreCase(...)
may  be a slippery slope - which has been intentionally avoided.  I have also considered overloading
the above eight methods with a Comparator parameter, but requiring a user to pass in a not-null,
case-insensitive comparator didn't seem as straight forward as the above solution.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message