Added more detail to the explanation of the oddly backwards way that difference(String, String) works as noted in LANG-784

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1470262 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2013-04-21 04:52:28 +00:00
parent d49d8093e2
commit 9d73fe09ce
1 changed files with 5 additions and 2 deletions

View File

@ -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) {