You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2013/04/21 06:52:28 UTC

svn commit: r1470262 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java

Author: bayard
Date: Sun Apr 21 04:52:28 2013
New Revision: 1470262

URL: http://svn.apache.org/r1470262
Log:
Added more detail to the explanation of the oddly backwards way that difference(String, String) works as noted in LANG-784

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=1470262&r1=1470261&r2=1470262&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 Sun Apr 21 04:52:28 2013
@@ -6340,8 +6340,9 @@ public class StringUtils {
     //-----------------------------------------------------------------------
     /**
      * <p>Compares two Strings, and returns the portion where they differ.
-     * (More precisely, return the remainder of the second String,
-     * starting from where it's different from the first.)</p>
+     * More precisely, return the remainder of the second String,
+     * starting from where it's different from the first. This means that 
+     * the difference between "abc" and "ab" is the empty String and not "c". </p>
      *
      * <p>For example,
      * {@code difference("i am a machine", "i am a robot") -> "robot"}.</p>
@@ -6352,6 +6353,7 @@ public class StringUtils {
      * StringUtils.difference("", "abc") = "abc"
      * StringUtils.difference("abc", "") = ""
      * StringUtils.difference("abc", "abc") = ""
+     * StringUtils.difference("abc", "ab") = ""
      * StringUtils.difference("ab", "abxyz") = "xyz"
      * StringUtils.difference("abcde", "abxyz") = "xyz"
      * StringUtils.difference("abcde", "xyz") = "xyz"
@@ -6361,6 +6363,7 @@ public class StringUtils {
      * @param str2  the second String, may be null
      * @return the portion of str2 where it differs from str1; returns the
      * empty String if they are equal
+     * @see #indexOfDifference(CharSequence,CharSequence)
      * @since 2.0
      */
     public static String difference(final String str1, final String str2) {