commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1407537 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Date Fri, 09 Nov 2012 16:50:40 GMT
Author: mbenson
Date: Fri Nov  9 16:50:39 2012
New Revision: 1407537

URL: http://svn.apache.org/viewvc?rev=1407537&view=rev
Log:
explain 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=1407537&r1=1407536&r2=1407537&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 Fri
Nov  9 16:50:39 2012
@@ -150,6 +150,11 @@ public class StringUtils {
 
     /**
      * A regex pattern for recognizing blocks of whitespace characters.
+     * The apparent convolutedness of the pattern serves the purpose of
+     * ignoring "blocks" consisting of only a single space:  the pattern
+     * is used only to normalize whitespace, condensing "blocks" down to a
+     * single space, thus matching the same would likely cause a great
+     * many noop replacements.
      */
     private static final Pattern WHITESPACE_PATTERN = Pattern.compile("(?: \\s|[\\s&&[^
]])\\s*");
 



Mime
View raw message