commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r1082414 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Date Thu, 17 Mar 2011 06:55:46 GMT
Author: bayard
Date: Thu Mar 17 06:55:46 2011
New Revision: 1082414

URL: http://svn.apache.org/viewvc?rev=1082414&view=rev
Log:
Moving contains(String, int) over to CharSequence. 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=1082414&r1=1082413&r2=1082414&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 Thu
Mar 17 06:55:46 2011
@@ -1326,10 +1326,10 @@ public class StringUtils {
     // Contains
     //-----------------------------------------------------------------------
     /**
-     * <p>Checks if String contains a search character, handling {@code null}.
-     * This method uses {@link String#indexOf(int)}.</p>
+     * <p>Checks if CharSequence contains a search character, handling {@code null}.
+     * This method uses {@link String#indexOf(int)} if possible.</p>
      *
-     * <p>A {@code null} or empty ("") String will return {@code false}.</p>
+     * <p>A {@code null} or empty ("") CharSequence will return {@code false}.</p>
      *
      * <pre>
      * StringUtils.contains(null, *)    = false
@@ -1338,17 +1338,17 @@ public class StringUtils {
      * StringUtils.contains("abc", 'z') = false
      * </pre>
      *
-     * @param str  the String to check, may be null
+     * @param seq  the CharSequence to check, may be null
      * @param searchChar  the character to find
-     * @return true if the String contains the search character,
+     * @return true if the CharSequence contains the search character,
      *  false if not or {@code null} string input
      * @since 2.0
      */
-    public static boolean contains(String str, int searchChar) {
-        if (isEmpty(str)) {
+    public static boolean contains(CharSequence seq, int searchChar) {
+        if (isEmpty(seq)) {
             return false;
         }
-        return str.indexOf(searchChar) >= 0;
+        return indexOfSequence(seq, searchChar, 0) >= 0;
     }
 
     /**



Mime
View raw message