commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Lyons (JIRA)" <>
Subject [jira] [Updated] (LANG-742) [IgnoreCase] methods for ArrayUtils
Date Wed, 17 Aug 2011 06:02:27 GMT


Michael Lyons updated LANG-742:


> [IgnoreCase] methods for ArrayUtils
> -----------------------------------
>                 Key: LANG-742
>                 URL:
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Michael Lyons
>            Priority: Minor
>         Attachments:,
> 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
> ...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 is automatically generated by JIRA.
For more information on JIRA, see:


View raw message