svn commit: r1859932 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util: StringUtil.java test/StringUtilTests.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1859932 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util: StringUtil.java test/StringUtilTests.java

mthl
Author: mthl
Date: Sat May 25 09:27:09 2019
New Revision: 1859932

URL: http://svn.apache.org/viewvc?rev=1859932&view=rev
Log:
Improved: Remove unused ‘StringUtil#collapseCharacter’
(OFBIZ-11014)

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java?rev=1859932&r1=1859931&r2=1859932&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java Sat May 25 09:27:09 2019
@@ -425,28 +425,6 @@ public class StringUtil {
         return result;
     }
 
-    /**
-     * Remove/collapse multiple characters
-     *
-     * @param str string to collapse characters in
-     * @param c character to collapse
-     * @return the converted string
-     */
-    public static String collapseCharacter(String str, char c) {
-        StringBuilder sb = new StringBuilder();
-        char last = str.charAt(0);
-
-        for (int i = 0; i < str.length(); i++) {
-            char current = str.charAt(i);
-            if (i == 0 || current != c || last != c) {
-                sb.append(current);
-                last = current;
-            }
-        }
-
-        return sb.toString();
-    }
-
     public static StringWrapper wrapString(String theString) {
         return makeStringWrapper(theString);
     }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java?rev=1859932&r1=1859931&r2=1859932&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java Sat May 25 09:27:09 2019
@@ -225,12 +225,6 @@ public class StringUtilTests extends Gen
     public void testCollapseSpaces() {
     }
 
-    public void testCollapseCharacter() {
-        assertEquals("not-found", "abcdefg", StringUtil.collapseCharacter("abcdefg", '.'));
-        assertEquals("no-change", "abcdefg", StringUtil.collapseCharacter("abcdefg", 'a'));
-        assertEquals("duplicate", "abcdefa", StringUtil.collapseCharacter("aabcdefaa", 'a'));
-    }
-
     public void testWrapString() {
     }