commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringUtils.java
Date Thu, 21 Aug 2003 22:13:24 GMT
ggregory    2003/08/21 15:13:24

  Modified:    lang/src/test/org/apache/commons/lang StringUtilsTest.java
               lang/src/java/org/apache/commons/lang StringUtils.java
  Log:
  Renamed StringUtils.differenceAt() to StringUtils.indexOfDifference()
  
  Revision  Changes    Path
  1.52      +10 -10    jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java
  
  Index: StringUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- StringUtilsTest.java	18 Aug 2003 02:22:25 -0000	1.51
  +++ StringUtilsTest.java	21 Aug 2003 22:13:24 -0000	1.52
  @@ -942,15 +942,15 @@
       }
   
       public void testDifferenceAt_StringString() {
  -        assertEquals(-1, StringUtils.differenceAt(null, null));
  -        assertEquals(0, StringUtils.differenceAt(null, "i am a robot"));
  -        assertEquals(-1, StringUtils.differenceAt("", ""));
  -        assertEquals(0, StringUtils.differenceAt("", "abc"));
  -        assertEquals(0, StringUtils.differenceAt("abc", ""));
  -        assertEquals(0, StringUtils.differenceAt("i am a machine", null));
  -        assertEquals(7, StringUtils.differenceAt("i am a machine", "i am a robot"));
  -        assertEquals(-1, StringUtils.differenceAt("foo", "foo"));
  -        assertEquals(0, StringUtils.differenceAt("i am a robot", "you are a robot"));
  +        assertEquals(-1, StringUtils.indexOfDifference(null, null));
  +        assertEquals(0, StringUtils.indexOfDifference(null, "i am a robot"));
  +        assertEquals(-1, StringUtils.indexOfDifference("", ""));
  +        assertEquals(0, StringUtils.indexOfDifference("", "abc"));
  +        assertEquals(0, StringUtils.indexOfDifference("abc", ""));
  +        assertEquals(0, StringUtils.indexOfDifference("i am a machine", null));
  +        assertEquals(7, StringUtils.indexOfDifference("i am a machine", "i am a robot"));
  +        assertEquals(-1, StringUtils.indexOfDifference("foo", "foo"));
  +        assertEquals(0, StringUtils.indexOfDifference("i am a robot", "you are a robot"));
       }
   
       //-----------------------------------------------------------------------
  
  
  
  1.105     +11 -11    jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java
  
  Index: StringUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- StringUtils.java	21 Aug 2003 05:57:21 -0000	1.104
  +++ StringUtils.java	21 Aug 2003 22:13:24 -0000	1.105
  @@ -4143,7 +4143,7 @@
           if (str2 == null) {
               return str1;
           }
  -        int at = differenceAt(str1, str2);
  +        int at = indexOfDifference(str1, str2);
           if (at == -1) {
               return EMPTY;
           }
  @@ -4158,14 +4158,14 @@
        * <code>differenceAt("i am a machine", "i am a robot") -> 7</code></p>
        *
        * <pre>
  -     * StringUtils.differenceAt(null, null) = -1
  -     * StringUtils.differenceAt("", "") = -1
  -     * StringUtils.differenceAt("", "abc") = 0
  -     * StringUtils.differenceAt("abc", "") = 0
  -     * StringUtils.differenceAt("abc", "abc") = -1
  -     * StringUtils.differenceAt("ab", "abxyz") = 2
  -     * StringUtils.differenceAt("abcde", "abxyz") = 2
  -     * StringUtils.differenceAt("abcde", "xyz") = 0
  +     * StringUtils.indexOfDifference(null, null) = -1
  +     * StringUtils.indexOfDifference("", "") = -1
  +     * StringUtils.indexOfDifference("", "abc") = 0
  +     * StringUtils.indexOfDifference("abc", "") = 0
  +     * StringUtils.indexOfDifference("abc", "abc") = -1
  +     * StringUtils.indexOfDifference("ab", "abxyz") = 2
  +     * StringUtils.indexOfDifference("abcde", "abxyz") = 2
  +     * StringUtils.indexOfDifference("abcde", "xyz") = 0
        * </pre>
        *
        * @param str1  the first String, may be null
  @@ -4173,7 +4173,7 @@
        * @return the index where str2 and str1 begin to differ; -1 if they are equal
        * @since 2.0
        */
  -    public static int differenceAt(String str1, String str2) {
  +    public static int indexOfDifference(String str1, String str2) {
           if (str1 == str2) {
               return -1;
           }
  
  
  

Mime
View raw message