You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2016/09/24 10:19:53 UTC
[1/3] [lang] LANG-787: Add StringUtils#removeIgnoreCase
Repository: commons-lang
Updated Branches:
refs/heads/master db6f7c1d7 -> cac7a60ab
LANG-787: Add StringUtils#removeIgnoreCase
Patch by Gokul Nanthakumar C
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/eccf2132
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/eccf2132
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/eccf2132
Branch: refs/heads/master
Commit: eccf213204b776e40efcc031f4c0df560b9421e9
Parents: 1e4a490
Author: pascalschumacher <pa...@gmx.net>
Authored: Fri May 20 18:59:00 2016 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Fri May 20 18:59:00 2016 +0200
----------------------------------------------------------------------
.../org/apache/commons/lang3/StringUtils.java | 216 +++++++++++++++++--
.../apache/commons/lang3/StringUtilsTest.java | 123 +++++++++++
2 files changed, 316 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eccf2132/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 31a572a..4e2e453 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -4701,6 +4701,46 @@ public class StringUtils {
}
/**
+ * <p>
+ * Case insensitive removal of all occurrences of a substring from within
+ * the source string.
+ * </p>
+ *
+ * <p>
+ * A {@code null} source string will return {@code null}. An empty ("")
+ * source string will return the empty string. A {@code null} remove string
+ * will return the source string. An empty ("") remove string will return
+ * the source string.
+ * </p>
+ *
+ * <pre>
+ * StringUtils.removeIgnoreCase(null, *) = null
+ * StringUtils.removeIgnoreCase("", *) = ""
+ * StringUtils.removeIgnoreCase(*, null) = *
+ * StringUtils.removeIgnoreCase(*, "") = *
+ * StringUtils.removeIgnoreCase("queued", "ue") = "qd"
+ * StringUtils.removeIgnoreCase("queued", "zz") = "queued"
+ * StringUtils.removeIgnoreCase("quEUed", "UE") = "qd"
+ * StringUtils.removeIgnoreCase("queued", "zZ") = "queued"
+ * </pre>
+ *
+ * @param str
+ * the source String to search, may be null
+ * @param remove
+ * the String to search for (case insensitive) and remove, may be
+ * null
+ * @return the substring with the string removed if found, {@code null} if
+ * null String input
+ * @since 3.5
+ */
+ public static String removeIgnoreCase(String str, String remove) {
+ if (isEmpty(str) || isEmpty(remove)) {
+ return str;
+ }
+ return replaceIgnoreCase(str, remove, EMPTY, -1);
+ }
+
+ /**
* <p>Removes all occurrences of a character from within the source string.</p>
*
* <p>A {@code null} source string will return {@code null}.
@@ -4856,6 +4896,35 @@ public class StringUtils {
}
/**
+ * <p>Case insensitively replaces a String with another String inside a larger String, once.</p>
+ *
+ * <p>A {@code null} reference passed to this method is a no-op.</p>
+ *
+ * <pre>
+ * StringUtils.replaceOnceIgnoreCase(null, *, *) = null
+ * StringUtils.replaceOnceIgnoreCase("", *, *) = ""
+ * StringUtils.replaceOnceIgnoreCase("any", null, *) = "any"
+ * StringUtils.replaceOnceIgnoreCase("any", *, null) = "any"
+ * StringUtils.replaceOnceIgnoreCase("any", "", *) = "any"
+ * StringUtils.replaceOnceIgnoreCase("aba", "a", null) = "aba"
+ * StringUtils.replaceOnceIgnoreCase("aba", "a", "") = "ba"
+ * StringUtils.replaceOnceIgnoreCase("aba", "a", "z") = "zba"
+ * StringUtils.replaceOnceIgnoreCase("FoOFoofoo", "foo", "") = "Foofoo"
+ * </pre>
+ *
+ * @see #replaceIgnoreCase(String text, String searchString, String replacement, int max)
+ * @param text text to search and replace in, may be null
+ * @param searchString the String to search for (case insensitive), may be null
+ * @param replacement the String to replace with, may be null
+ * @return the text with any replacements processed,
+ * {@code null} if null String input
+ * @since 3.5
+ */
+ public static String replaceOnceIgnoreCase(String text, String searchString, String replacement) {
+ return replaceIgnoreCase(text, searchString, replacement, 1);
+ }
+
+ /**
* <p>Replaces each substring of the source String that matches the given regular expression with the given
* replacement using the {@link Pattern#DOTALL} option. DOTALL is also know as single-line mode in Perl.</p>
*
@@ -5071,6 +5140,34 @@ public class StringUtils {
}
/**
+ * <p>Case insensitively replaces all occurrences of a String within another String.</p>
+ *
+ * <p>A {@code null} reference passed to this method is a no-op.</p>
+ *
+ * <pre>
+ * StringUtils.replaceIgnoreCase(null, *, *) = null
+ * StringUtils.replaceIgnoreCase("", *, *) = ""
+ * StringUtils.replaceIgnoreCase("any", null, *) = "any"
+ * StringUtils.replaceIgnoreCase("any", *, null) = "any"
+ * StringUtils.replaceIgnoreCase("any", "", *) = "any"
+ * StringUtils.replaceIgnoreCase("aba", "a", null) = "aba"
+ * StringUtils.replaceIgnoreCase("abA", "A", "") = "b"
+ * StringUtils.replaceIgnoreCase("aba", "A", "z") = "zbz"
+ * </pre>
+ *
+ * @see #replaceIgnoreCase(String text, String searchString, String replacement, int max)
+ * @param text text to search and replace in, may be null
+ * @param searchString the String to search for (case insensitive), may be null
+ * @param replacement the String to replace it with, may be null
+ * @return the text with any replacements processed,
+ * {@code null} if null String input
+ * @since 3.5
+ */
+ public static String replaceIgnoreCase(String text, String searchString, String replacement) {
+ return replaceIgnoreCase(text, searchString, replacement, -1);
+ }
+
+ /**
* <p>Replaces a String with another String inside a larger String,
* for the first {@code max} values of the search String.</p>
*
@@ -5099,29 +5196,102 @@ public class StringUtils {
* {@code null} if null String input
*/
public static String replace(final String text, final String searchString, final String replacement, int max) {
- if (isEmpty(text) || isEmpty(searchString) || replacement == null || max == 0) {
- return text;
- }
- int start = 0;
- int end = text.indexOf(searchString, start);
- if (end == INDEX_NOT_FOUND) {
- return text;
- }
- final int replLength = searchString.length();
- int increase = replacement.length() - replLength;
- increase = increase < 0 ? 0 : increase;
- increase *= max < 0 ? 16 : max > 64 ? 64 : max;
- final StringBuilder buf = new StringBuilder(text.length() + increase);
- while (end != INDEX_NOT_FOUND) {
- buf.append(text.substring(start, end)).append(replacement);
- start = end + replLength;
- if (--max == 0) {
- break;
- }
- end = text.indexOf(searchString, start);
- }
- buf.append(text.substring(start));
- return buf.toString();
+ return replace(text, searchString, replacement, max, false);
+ }
+
+ /**
+ * <p>Replaces a String with another String inside a larger String,
+ * for the first {@code max} values of the search String,
+ * case sensitively/insensisitively based on {@code ignoreCase} value.</p>
+ *
+ * <p>A {@code null} reference passed to this method is a no-op.</p>
+ *
+ * <pre>
+ * StringUtils.replace(null, *, *, *, false) = null
+ * StringUtils.replace("", *, *, *, false) = ""
+ * StringUtils.replace("any", null, *, *, false) = "any"
+ * StringUtils.replace("any", *, null, *, false) = "any"
+ * StringUtils.replace("any", "", *, *, false) = "any"
+ * StringUtils.replace("any", *, *, 0, false) = "any"
+ * StringUtils.replace("abaa", "a", null, -1, false) = "abaa"
+ * StringUtils.replace("abaa", "a", "", -1, false) = "b"
+ * StringUtils.replace("abaa", "a", "z", 0, false) = "abaa"
+ * StringUtils.replace("abaa", "A", "z", 1, false) = "abaa"
+ * StringUtils.replace("abaa", "A", "z", 1, true) = "zbaa"
+ * StringUtils.replace("abAa", "a", "z", 2, true) = "zbza"
+ * StringUtils.replace("abAa", "a", "z", -1, true) = "zbzz"
+ * </pre>
+ *
+ * @param text text to search and replace in, may be null
+ * @param searchString the String to search for (case insensitive), may be null
+ * @param replacement the String to replace it with, may be null
+ * @param max maximum number of values to replace, or {@code -1} if no maximum
+ * @param ignoreCase if true replace is case insensitive, otherwise case sensitive
+ * @return the text with any replacements processed,
+ * {@code null} if null String input
+ */
+ private static String replace(String text, String searchString, String replacement, int max, boolean ignoreCase) {
+ if (isEmpty(text) || isEmpty(searchString) || replacement == null || max == 0) {
+ return text;
+ }
+ String searchText = text;
+ if (ignoreCase) {
+ searchText = text.toLowerCase();
+ searchString = searchString.toLowerCase();
+ }
+ int start = 0;
+ int end = searchText.indexOf(searchString, start);
+ if (end == INDEX_NOT_FOUND) {
+ return text;
+ }
+ final int replLength = searchString.length();
+ int increase = replacement.length() - replLength;
+ increase = increase < 0 ? 0 : increase;
+ increase *= max < 0 ? 16 : max > 64 ? 64 : max;
+ final StringBuilder buf = new StringBuilder(text.length() + increase);
+ while (end != INDEX_NOT_FOUND) {
+ buf.append(text.substring(start, end)).append(replacement);
+ start = end + replLength;
+ if (--max == 0) {
+ break;
+ }
+ end = searchText.indexOf(searchString, start);
+ }
+ buf.append(text.substring(start));
+ return buf.toString();
+ }
+
+ /**
+ * <p>Case insensitively replaces a String with another String inside a larger String,
+ * for the first {@code max} values of the search String.</p>
+ *
+ * <p>A {@code null} reference passed to this method is a no-op.</p>
+ *
+ * <pre>
+ * StringUtils.replaceIgnoreCase(null, *, *, *) = null
+ * StringUtils.replaceIgnoreCase("", *, *, *) = ""
+ * StringUtils.replaceIgnoreCase("any", null, *, *) = "any"
+ * StringUtils.replaceIgnoreCase("any", *, null, *) = "any"
+ * StringUtils.replaceIgnoreCase("any", "", *, *) = "any"
+ * StringUtils.replaceIgnoreCase("any", *, *, 0) = "any"
+ * StringUtils.replaceIgnoreCase("abaa", "a", null, -1) = "abaa"
+ * StringUtils.replaceIgnoreCase("abaa", "a", "", -1) = "b"
+ * StringUtils.replaceIgnoreCase("abaa", "a", "z", 0) = "abaa"
+ * StringUtils.replaceIgnoreCase("abaa", "A", "z", 1) = "zbaa"
+ * StringUtils.replaceIgnoreCase("abAa", "a", "z", 2) = "zbza"
+ * StringUtils.replaceIgnoreCase("abAa", "a", "z", -1) = "zbzz"
+ * </pre>
+ *
+ * @param text text to search and replace in, may be null
+ * @param searchString the String to search for (case insensitive), may be null
+ * @param replacement the String to replace it with, may be null
+ * @param max maximum number of values to replace, or {@code -1} if no maximum
+ * @return the text with any replacements processed,
+ * {@code null} if null String input
+ * @since 3.5
+ */
+ public static String replaceIgnoreCase(String text, String searchString, String replacement, int max) {
+ return replace(text, searchString, replacement, max, true);
}
/**
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eccf2132/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 1fa164e..df48c27 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -1209,6 +1209,33 @@ public class StringUtilsTest {
}
@Test
+ public void testReplaceIgnoreCase_StringStringString() {
+ assertEquals(null, StringUtils.replaceIgnoreCase(null, null, null));
+ assertEquals(null, StringUtils.replaceIgnoreCase(null, null, "any"));
+ assertEquals(null, StringUtils.replaceIgnoreCase(null, "any", null));
+ assertEquals(null, StringUtils.replaceIgnoreCase(null, "any", "any"));
+
+ assertEquals("", StringUtils.replaceIgnoreCase("", null, null));
+ assertEquals("", StringUtils.replaceIgnoreCase("", null, "any"));
+ assertEquals("", StringUtils.replaceIgnoreCase("", "any", null));
+ assertEquals("", StringUtils.replaceIgnoreCase("", "any", "any"));
+
+ assertEquals("FOO", StringUtils.replaceIgnoreCase("FOO", "", "any"));
+ assertEquals("FOO", StringUtils.replaceIgnoreCase("FOO", null, "any"));
+ assertEquals("FOO", StringUtils.replaceIgnoreCase("FOO", "F", null));
+ assertEquals("FOO", StringUtils.replaceIgnoreCase("FOO", null, null));
+
+ assertEquals("", StringUtils.replaceIgnoreCase("foofoofoo", "foo", ""));
+ assertEquals("barbarbar", StringUtils.replaceIgnoreCase("foofoofoo", "foo", "bar"));
+ assertEquals("farfarfar", StringUtils.replaceIgnoreCase("foofoofoo", "oo", "ar"));
+
+ // IgnoreCase
+ assertEquals("", StringUtils.replaceIgnoreCase("foofoofoo", "FOO", ""));
+ assertEquals("barbarbar", StringUtils.replaceIgnoreCase("fooFOOfoo", "foo", "bar"));
+ assertEquals("farfarfar", StringUtils.replaceIgnoreCase("foofOOfoo", "OO", "ar"));
+ }
+
+ @Test
public void testReplacePattern() {
assertNull(StringUtils.replacePattern(null, "", ""));
assertEquals("any", StringUtils.replacePattern("any", null, ""));
@@ -1331,6 +1358,43 @@ public class StringUtilsTest {
}
@Test
+ public void testReplaceIgnoreCase_StringStringStringInt() {
+ assertEquals(null, StringUtils.replaceIgnoreCase(null, null, null, 2));
+ assertEquals(null, StringUtils.replaceIgnoreCase(null, null, "any", 2));
+ assertEquals(null, StringUtils.replaceIgnoreCase(null, "any", null, 2));
+ assertEquals(null, StringUtils.replaceIgnoreCase(null, "any", "any", 2));
+
+ assertEquals("", StringUtils.replaceIgnoreCase("", null, null, 2));
+ assertEquals("", StringUtils.replaceIgnoreCase("", null, "any", 2));
+ assertEquals("", StringUtils.replaceIgnoreCase("", "any", null, 2));
+ assertEquals("", StringUtils.replaceIgnoreCase("", "any", "any", 2));
+
+ String str = new String(new char[] { 'o', 'o', 'f', 'o', 'o' });
+ assertSame(str, StringUtils.replaceIgnoreCase(str, "x", "", -1));
+
+ assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "o", "", -1));
+ assertEquals("oofoo", StringUtils.replaceIgnoreCase("oofoo", "o", "", 0));
+ assertEquals("ofoo", StringUtils.replaceIgnoreCase("oofoo", "o", "", 1));
+ assertEquals("foo", StringUtils.replaceIgnoreCase("oofoo", "o", "", 2));
+ assertEquals("fo", StringUtils.replaceIgnoreCase("oofoo", "o", "", 3));
+ assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "o", "", 4));
+
+ assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "o", "", -5));
+ assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "o", "", 1000));
+
+ // IgnoreCase
+ assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "O", "", -1));
+ assertEquals("oofoo", StringUtils.replaceIgnoreCase("oofoo", "O", "", 0));
+ assertEquals("ofoo", StringUtils.replaceIgnoreCase("oofoo", "O", "", 1));
+ assertEquals("foo", StringUtils.replaceIgnoreCase("oofoo", "O", "", 2));
+ assertEquals("fo", StringUtils.replaceIgnoreCase("oofoo", "O", "", 3));
+ assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "O", "", 4));
+
+ assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "O", "", -5));
+ assertEquals("f", StringUtils.replaceIgnoreCase("oofoo", "O", "", 1000));
+ }
+
+ @Test
public void testReplaceOnce_StringStringString() {
assertNull(StringUtils.replaceOnce(null, null, null));
assertNull(StringUtils.replaceOnce(null, null, "any"));
@@ -1350,6 +1414,29 @@ public class StringUtilsTest {
assertEquals("foofoo", StringUtils.replaceOnce("foofoofoo", "foo", ""));
}
+ @Test
+ public void testReplaceOnceIgnoreCase_StringStringString() {
+ assertEquals(null, StringUtils.replaceOnceIgnoreCase(null, null, null));
+ assertEquals(null, StringUtils.replaceOnceIgnoreCase(null, null, "any"));
+ assertEquals(null, StringUtils.replaceOnceIgnoreCase(null, "any", null));
+ assertEquals(null, StringUtils.replaceOnceIgnoreCase(null, "any", "any"));
+
+ assertEquals("", StringUtils.replaceOnceIgnoreCase("", null, null));
+ assertEquals("", StringUtils.replaceOnceIgnoreCase("", null, "any"));
+ assertEquals("", StringUtils.replaceOnceIgnoreCase("", "any", null));
+ assertEquals("", StringUtils.replaceOnceIgnoreCase("", "any", "any"));
+
+ assertEquals("FOO", StringUtils.replaceOnceIgnoreCase("FOO", "", "any"));
+ assertEquals("FOO", StringUtils.replaceOnceIgnoreCase("FOO", null, "any"));
+ assertEquals("FOO", StringUtils.replaceOnceIgnoreCase("FOO", "F", null));
+ assertEquals("FOO", StringUtils.replaceOnceIgnoreCase("FOO", null, null));
+
+ assertEquals("foofoo", StringUtils.replaceOnceIgnoreCase("foofoofoo", "foo", ""));
+
+ // Ignore Case
+ assertEquals("Foofoo", StringUtils.replaceOnceIgnoreCase("FoOFoofoo", "foo", ""));
+ }
+
/**
* Test method for 'StringUtils.replaceEach(String, String[], String[])'
*/
@@ -2393,6 +2480,42 @@ public class StringUtilsTest {
}
@Test
+ public void testRemoveIgnoreCase_String() {
+ // StringUtils.removeIgnoreCase(null, *) = null
+ assertEquals(null, StringUtils.removeIgnoreCase(null, null));
+ assertEquals(null, StringUtils.removeIgnoreCase(null, ""));
+ assertEquals(null, StringUtils.removeIgnoreCase(null, "a"));
+
+ // StringUtils.removeIgnoreCase("", *) = ""
+ assertEquals("", StringUtils.removeIgnoreCase("", null));
+ assertEquals("", StringUtils.removeIgnoreCase("", ""));
+ assertEquals("", StringUtils.removeIgnoreCase("", "a"));
+
+ // StringUtils.removeIgnoreCase(*, null) = *
+ assertEquals(null, StringUtils.removeIgnoreCase(null, null));
+ assertEquals("", StringUtils.removeIgnoreCase("", null));
+ assertEquals("a", StringUtils.removeIgnoreCase("a", null));
+
+ // StringUtils.removeIgnoreCase(*, "") = *
+ assertEquals(null, StringUtils.removeIgnoreCase(null, ""));
+ assertEquals("", StringUtils.removeIgnoreCase("", ""));
+ assertEquals("a", StringUtils.removeIgnoreCase("a", ""));
+
+ // StringUtils.removeIgnoreCase("queued", "ue") = "qd"
+ assertEquals("qd", StringUtils.removeIgnoreCase("queued", "ue"));
+
+ // StringUtils.removeIgnoreCase("queued", "zz") = "queued"
+ assertEquals("queued", StringUtils.removeIgnoreCase("queued", "zz"));
+
+ // IgnoreCase
+ // StringUtils.removeIgnoreCase("quEUed", "UE") = "qd"
+ assertEquals("qd", StringUtils.removeIgnoreCase("quEUed", "UE"));
+
+ // StringUtils.removeIgnoreCase("queued", "zZ") = "queued"
+ assertEquals("queued", StringUtils.removeIgnoreCase("queued", "zZ"));
+ }
+
+ @Test
public void testRemove_char() {
// StringUtils.remove(null, *) = null
assertNull(StringUtils.remove(null, 'a'));
[2/3] [lang] Add LANG-787 to changes.xml
Posted by br...@apache.org.
Add LANG-787 to changes.xml
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/a27c02f8
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/a27c02f8
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/a27c02f8
Branch: refs/heads/master
Commit: a27c02f809b8f2d23ad157f36420b3f5c45d7568
Parents: eccf213
Author: Benedikt Ritter <br...@apache.org>
Authored: Sat Sep 24 12:18:40 2016 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sat Sep 24 12:18:40 2016 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a27c02f8/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 40eaee4..fbb0fcd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -22,6 +22,7 @@
<body>
<release version="3.5" date="tba" description="tba">
+ <action issue="LANG-787" type="add" dev="pschumacher" due-to="Gokul Nanthakumar C">Add method removeIgnoreCase(String, String) to StringUtils</action>
<action issue="LANG-1232" type="fix" dev="pschumacher" due-to="Nick Manley">DiffBuilder: Add null check on fieldName when appending Object or Object[]</action>
<action issue="LANG-1178" type="fix" dev="pschumacher" due-to="Henri Yandell">ArrayUtils.removeAll(Object array, int... indices) should do the clone, not its callers</action>
<action issue="LANG-1151" type="update" dev="pschumacher" due-to="Juan Pablo Santos Rodr�guez">Performance improvements for NumberUtils.isParsable</action>
[3/3] [lang] Merge branch 'LANG-787'
Posted by br...@apache.org.
Merge branch 'LANG-787'
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/cac7a60a
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/cac7a60a
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/cac7a60a
Branch: refs/heads/master
Commit: cac7a60abf0a4451a5c80ef57343a14ea1ba443f
Parents: db6f7c1 a27c02f
Author: Benedikt Ritter <br...@apache.org>
Authored: Sat Sep 24 12:19:35 2016 +0200
Committer: Benedikt Ritter <br...@apache.org>
Committed: Sat Sep 24 12:19:35 2016 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/StringUtils.java | 216 +++++++++++++++++--
.../apache/commons/lang3/StringUtilsTest.java | 123 +++++++++++
3 files changed, 317 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cac7a60a/src/changes/changes.xml
----------------------------------------------------------------------
diff --cc src/changes/changes.xml
index bc720f7,fbb0fcd..a9b58e2
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@@ -45,43 -21,8 +45,44 @@@ The <action> type attribute can be add,
</properties>
<body>
- <release version="3.5" date="tba" description="tba">
+ <release version="3.5" date="tba" description="New features including Java 9 detection">
+ <action issue="LANG-787" type="add" dev="pschumacher" due-to="Gokul Nanthakumar C">Add method removeIgnoreCase(String, String) to StringUtils</action>
+ <action issue="LANG-1261" type="fix" dev="pschumacher" >ArrayUtils.contains returns false for instances of subtypes</action>
+ <action issue="LANG-1197" type="update" dev="pschumacher" >Prepare Java 9 detection</action>
+ <action issue="LANG-1252" type="fix" dev="chtompki" due-to="Rob Tompkins">Rename NumberUtils.isNumber, isCreatable to better reflect createNumber. Also, accommodated for "+" symbol as prefix in isCreatable and isNumber.</action>
+ <action issue="LANG-1262" type="update" dev="pschumacher" due-to="Ruslan Cheremin">CompareToBuilder.append(Object, Object, Comparator) method is too big to be inlined</action>
+ <action issue="LANG-1230" type="fix" dev="pschumacher" due-to="Philippe Marschall">Remove unnecessary synchronization from registry lookup in EqualsBuilder and HashCodeBuilder</action>
+ <action issue="LANG-1224" type="add" dev="pschumacher" due-to="Caleb Cushing">Extend RandomStringUtils with methods that generate strings between a min and max length</action>
+ <action issue="LANG-1214" type="fix" dev="pschumacher" due-to="Henry Tung">Handle "void" in ClassUtils.getClass()</action>
+ <action issue="LANG-1250" type="fix" dev="pschumacher" due-to="Glease Wang">SerializationUtils#deserialize has unnecessary code and a comment for that</action>
+ <action issue="LANG-1259" type="update" dev="britter" due-to="Dominik Stadler">JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading</action>
+ <action issue="LANG-1257" type="add" dev="ggregory" due-to="Gary Gregory">Add APIs StringUtils.wrapIfMissing(String, char|String)</action>
+ <action issue="LANG-1190" type="fix" dev="pschumacher" due-to="pschumacher">TypeUtils.isAssignable throws NullPointerException when fromType has type variables and toType generic superclass specifies type variable</action>
+ <action issue="LANG-1226" type="fix" dev="pschumacher" due-to="pschumacher">StringUtils#normalizeSpace does not trim the string anymore</action>
+ <action issue="LANG-1251" type="fix" dev="pschumacher" due-to="Takuya Ueshin">SerializationUtils.ClassLoaderAwareObjectInputStream should use static initializer to initialize primitiveTypes map</action>
+ <action issue="LANG-1253" type="add" dev="ggregory" due-to="adilek">[GitHub issue #170] Add RandomUtils#nextBoolean() method</action>
+ <action issue="LANG-1247" type="update" dev="chas" due-to="Benoit Wiart">FastDatePrinter generates extra Date objects</action>
+ <action issue="LANG-1018" type="fix" dev="pschumacher" due-to="Nick Manley">Fix precision loss on NumberUtils.createNumber(String)</action>
+ <action issue="LANG-1229" type="update" dev="pschumacher" due-to="Ruslan Cheremin">HashCodeBuilder.append(Object,Object) is too big to be inlined, which prevents whole builder to be scalarized</action>
+ <action issue="LANG-1085" type="add" dev="oheger" due-to="oheger / kinow">Add a circuit breaker implementation</action>
+ <action issue="LANG-1013" type="add" dev="pschumacher" due-to="Thiago Andrade">Add StringUtils.truncate()</action>
+ <action issue="LANG-1195" type="add" dev="pschumacher" due-to="Derek C. Ashmore">Enhance MethodUtils to allow invocation of private methods</action>
+ <action issue="LANG-1199" type="fix" dev="pschumacher" due-to="M. Steiger">Fix implementation of StringUtils.getJaroWinklerDistance()</action>
+ <action issue="LANG-1244" type="fix" dev="pschumacher" due-to="jjbankert">Fix dead links in StringUtils.getLevenshteinDistance() javadoc</action>
+ <action issue="LANG-1242" type="fix" dev="pschumacher" due-to="Neal Stewart">"\u2284":"⊄" mapping missing from EntityArrays#HTML40_EXTENDED_ESCAPE</action>
+ <action issue="LANG-1243" type="update" dev="sebb">Simplify ArrayUtils removeElements by using new decrementAndGet() method</action>
+ <action issue="LANG-1189" type="add" dev="sebb" due-to="haiyang li / Matthew Bartenschlag ">Add getAndIncrement/getAndDecrement/getAndAdd/incrementAndGet/decrementAndGet/addAndGet in Mutable* classes</action>
+ <action issue="LANG-1240" type="update" dev="pschumacher" due-to="zhanhb">Optimize BitField constructor implementation</action>
+ <action issue="LANG-1206" type="update" dev="pschumacher" due-to="Mohammed Alfallaj">Improve CharSetUtils.squeeze() performance</action>
+ <action issue="LANG-1225" type="add" dev="pschumacher" due-to="Caleb Cushing">Add RandomStringUtils#randomGraph and #randomPrint which match corresponding regular expression class</action>
+ <action issue="LANG-901" type="fix" dev="pschumacher" due-to="Matthew Bartenschlag">StringUtils#startsWithAny/endsWithAny is case sensitive - documented as case insensitive</action>
+ <action issue="LANG-1223" type="add" dev="pschumacher" due-to="Nick Manley">Add StopWatch#getTime(TimeUnit)</action>
+ <action issue="LANG-781" type="add" dev="pschumacher" due-to="Krzysztof Wolny">Add methods to ObjectUtils class to check for null elements in the array</action>
+ <action issue="LANG-1228" type="add" dev="pschumacher" due-to="Brad Hess">Prefer Throwable.getCause() in ExceptionUtils.getCause()</action>
+ <action issue="LANG-1233" type="add" dev="pschumacher" due-to="Nick Manley">DiffBuilder add method to allow appending from a DiffResult</action>
+ <action issue="LANG-1176" type="update" dev="pschumacher" due-to="Jeffery Yuan">Improve ArrayUtils removeElements time complexity to O(n)</action>
+ <action issue="LANG-1234" type="update" dev="pschumacher" due-to="Jonatan J�nsson">getLevenshteinDistance with a threshold: optimize implementation if the strings lengths differ more than the threshold</action>
+ <action issue="LANG-1168" type="add" dev="pschumacher" due-to="pschumacher">Add SystemUtils.IS_OS_WINDOWS_10 property</action>
<action issue="LANG-1232" type="fix" dev="pschumacher" due-to="Nick Manley">DiffBuilder: Add null check on fieldName when appending Object or Object[]</action>
<action issue="LANG-1178" type="fix" dev="pschumacher" due-to="Henri Yandell">ArrayUtils.removeAll(Object array, int... indices) should do the clone, not its callers</action>
<action issue="LANG-1151" type="update" dev="pschumacher" due-to="Juan Pablo Santos Rodr�guez">Performance improvements for NumberUtils.isParsable</action>
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cac7a60a/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/cac7a60a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
----------------------------------------------------------------------