You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/12/05 17:24:31 UTC

[commons-lang] branch master updated: [LANG-1584] Refine StringUtils.isNumericSpace (#573)

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-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new ea8428a  [LANG-1584] Refine StringUtils.isNumericSpace (#573)
ea8428a is described below

commit ea8428ab751501f777ec1ae68eec71e64e7a65ad
Author: XenoAmess <xe...@gmail.com>
AuthorDate: Sun Dec 6 01:24:22 2020 +0800

    [LANG-1584] Refine StringUtils.isNumericSpace (#573)
    
    * refine isNumericSpace
    
    * fix same issues in other two functions
---
 src/main/java/org/apache/commons/lang3/StringUtils.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index d96c5fe..82cd754 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -3398,7 +3398,8 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (!Character.isLetterOrDigit(cs.charAt(i)) && cs.charAt(i) != ' ') {
+            final char nowChar = cs.charAt(i);
+            if (nowChar != ' ' && !Character.isLetterOrDigit(nowChar) ) {
                 return false;
             }
         }
@@ -3433,7 +3434,8 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (!Character.isLetter(cs.charAt(i)) && cs.charAt(i) != ' ') {
+            final char nowChar = cs.charAt(i);
+            if (nowChar != ' ' && !Character.isLetter(nowChar)) {
                 return false;
             }
         }
@@ -3810,7 +3812,8 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (!Character.isDigit(cs.charAt(i)) && cs.charAt(i) != ' ') {
+            final char nowChar = cs.charAt(i);
+            if (nowChar != ' ' && !Character.isDigit(nowChar)) {
                 return false;
             }
         }