Author: jleroux
Date: Sun Nov 17 11:30:43 2013
New Revision: 1542708

URL: http://svn.apache.org/r1542708
Log:
No functional change, just simplify code.
Also some trailing spaces removed

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=1542708&r1=1542707&r2=1542708&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java 
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Sun Nov 
17 11:30:43 2013
@@ -28,7 +28,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javolution.context.ObjectFactory;
@@ -228,15 +227,15 @@ public class StringUtil {
         if (delim != null) st = Pattern.compile(delim).split(str, limit);
         else               st = str.split("\\s");
 
-        
+
         if (st != null && st.length > 0) {
             splitList = FastList.newInstance();
             for (int i=0; i < st.length; i++) splitList.add(st[i]);
         }
-        
+
         return splitList;
     }
-    
+
     /**
      * Encloses each of a List of Strings in quotes.
      * @param list List of String(s) to quote.
@@ -261,7 +260,7 @@ public class StringUtil {
      */
     public static Map<String, String> strToMap(String str, String delim, 
boolean trim) {
         return strToMap(str, delim, trim, null);
-        
+
     }
 
     /**
@@ -269,7 +268,7 @@ public class StringUtil {
      * @param str The string to decode and format
      * @param delim the delimiter character(s) to join on (null will split on 
whitespace)
      * @param trim Trim whitespace off fields
-     * @param pairsSeparator in case you use not encoded name/value pairs 
strings 
+     * @param pairsSeparator in case you use not encoded name/value pairs 
strings
      *        and want to replace "=" to avoid clashes with parameters values 
in a not encoded URL, default to "="
      * @return a Map of name/value pairs
      */
@@ -334,7 +333,7 @@ public class StringUtil {
         return strToMap(str, null, false);
     }
 
-    
+
     /**
      * Creates an encoded String from a Map of name/value pairs (MUST BE 
STRINGS!)
      * @param map The Map of name/value pairs
@@ -375,7 +374,7 @@ public class StringUtil {
         }
         return buf.toString();
     }
-    
+
     /**
      * Reads a String version of a Map (should contain only strings) and 
creates a new Map.
      * Partial Map elements are skipped: <code>{foo=fooValue, bar=}</code> 
will contain only
@@ -546,9 +545,7 @@ public class StringUtil {
      * Removes all matches of regex from a str
      */
     public static String removeRegex(String str, String regex) {
-        Pattern pattern = Pattern.compile(regex);
-        Matcher matcher = pattern.matcher(str);
-        return matcher.replaceAll("");
+        return str.replaceAll(regex, "");
     }
 
     /**


Reply via email to