This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new 30e7ae8  Refactor magic char.
30e7ae8 is described below

commit 30e7ae8952e69c71db5f425ec633683bd6dfbc1f
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Jul 21 10:54:56 2020 -0400

    Refactor magic char.
---
 src/main/java/org/apache/commons/text/TextStringBuilder.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java 
b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index 49e304d..4fa2574 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -75,6 +75,8 @@ import org.apache.commons.text.matcher.StringMatcher;
  */
 public class TextStringBuilder implements CharSequence, Appendable, 
Serializable, Builder<String> {
 
+    private static final char SPACE = ' ';
+
     /**
      * Inner class to allow StrBuilder to operate as a reader.
      */
@@ -3066,10 +3068,10 @@ public class TextStringBuilder implements CharSequence, 
Appendable, Serializable
         int len = size;
         final char[] buf = buffer;
         int pos = 0;
-        while (pos < len && buf[pos] <= ' ') {
+        while (pos < len && buf[pos] <= SPACE) {
             pos++;
         }
-        while (pos < len && buf[len - 1] <= ' ') {
+        while (pos < len && buf[len - 1] <= SPACE) {
             len--;
         }
         if (len < size) {

Reply via email to