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] [Commented] (LANG-687) Convert more of the StringUtils API to take CharSequence
Date Wed, 06 Apr 2011 05:26:06 GMT

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

Henri Yandell commented on LANG-687:
------------------------------------

Of the remaining methods, 8 are IgnoreCase based. This relies on String.java specific code
and we would have to reimplement at least regionMatches on top of the CharSequence API.

Of the other 7, ordinalIndexOf, lastIndexOf and countMatches are easy. startsWith, startsWithAny,
endsWith and endsWithAny also use regionMatches.

> Convert more of the StringUtils API to take CharSequence
> --------------------------------------------------------
>
>                 Key: LANG-687
>                 URL: https://issues.apache.org/jira/browse/LANG-687
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>            Reporter: Henri Yandell
>             Fix For: 3.0
>
>
> Use CharSequence and not String in the StringUtils API for non-mutating operations.
> Anything which has to choose between the mutable and immutable nature of CharSequence
subclasses (i.e. takes a String and returns a String), should not be changed. Anything that
does not mutate the input (even in spirit) should use CharSequence.
> Additionally there should be a unit test that uses reflection to confirm this rule is
in place.
> Listing remaining methods to move to CharSequence:
>     public static boolean equalsIgnoreCase(String str1, String str2) {
>     public static int ordinalIndexOf(String str, String searchStr, int ordinal) {
>     public static int indexOfIgnoreCase(String str, String searchStr) {
>     public static int indexOfIgnoreCase(String str, String searchStr, int startPos) {
>     public static int lastOrdinalIndexOf(String str, String searchStr, int ordinal) {
>     public static int lastIndexOfIgnoreCase(String str, String searchStr) {
>     public static int lastIndexOfIgnoreCase(String str, String searchStr, int startPos)
{
>     public static boolean containsIgnoreCase(String str, String searchStr) {
>     public static int countMatches(String str, String sub) {
>     public static boolean startsWith(String str, String prefix) {
>     public static boolean startsWithIgnoreCase(String str, String prefix) {
>     public static boolean startsWithAny(String string, String... searchStrings) {
>     public static boolean endsWith(String str, String suffix) {
>     public static boolean endsWithIgnoreCase(String str, String suffix) {
>     public static boolean endsWithAny(String string, String... searchStrings) {

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message