commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <Joerg.Schai...@scalaris.com>
Subject Fwd: svn commit: r1407141 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Date Fri, 09 Nov 2012 07:53:55 GMT
Hi Greg,

the pattern matches (also) a single space that gets replaced by a single 
space. Therefor are most of the actual performed replacements completely 
superfluous, since I expect this to be the common case. The pattern should 
be something along "[\\s&&[^ ]]\\s*".

- Jörg

--------------- 

Betreff: svn commit: r1407141 - 
/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Absender: ggregory-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.org
Datum: Thu, 08 Nov 2012 15:54:25 +0000
Newsgruppe: gmane.comp.jakarta.commons.scm

Author: ggregory
Date: Thu Nov  8 15:54:25 2012
New Revision: 1407141

URL: http://svn.apache.org/viewvc?rev=1407141&view=rev
Log:
Rename private WHITESPACE_BLOCK to WHITESPACE_PATTERN.

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=1407141&r1=1407140&r2=1407141&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 
Thu Nov  8 15:54:25 2012
@@ -144,7 +144,7 @@ public class StringUtils {
     /**
      * A regex pattern for recognizing blocks of whitespace characters.
      */
-    private static final Pattern WHITESPACE_BLOCK = 
Pattern.compile("\\s+");
+    private static final Pattern WHITESPACE_PATTERN = 
Pattern.compile("\\s+");
 
     /**
      * <p>{@code StringUtils} instances should NOT be constructed in
@@ -6472,7 +6472,7 @@ public class StringUtils {
         if (str == null) {
             return null;
         }
-        return WHITESPACE_BLOCK.matcher(trim(str)).replaceAll(" ");
+        return WHITESPACE_PATTERN.matcher(trim(str)).replaceAll(" ");
     }
 
     /**


--------------- 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message