commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r1089306 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Date Wed, 06 Apr 2011 05:34:26 GMT
Author: bayard
Date: Wed Apr  6 05:34:26 2011
New Revision: 1089306

URL: http://svn.apache.org/viewvc?rev=1089306&view=rev
Log:
Moving countMatches, ordinalIndexOf and lastOrdinalIndexOf over to a CharSequence-based API.
LANG-687

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=1089306&r1=1089305&r2=1089306&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Wed
Apr  6 05:34:26 2011
@@ -6491,4 +6491,14 @@ public class StringUtils {
         }
     }
 
+    static boolean regionMatchesSequence(CharSequence cs, boolean ignoreCase, int thisStart,

+                                         CharSequence substring, int start, int length)
+    {
+        if (cs instanceof String) {
+            return ((String) cs).regionMatches(ignoreCase, thisStart, substring, start, length);
+        } else {
+            // TODO: Implement rather than convert to String
+            return cs.toString().regionMatches(ignoreCase, thisStart, substring, start, length);
+    }
+
 }



Mime
View raw message