commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1623872 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
Date Tue, 09 Sep 2014 19:32:32 GMT
Author: britter
Date: Tue Sep  9 19:32:31 2014
New Revision: 1623872

URL: http://svn.apache.org/r1623872
Log:
Simplify statement by calling substring on str directly. StringUtils.startsWith makes sure
that str is not  null at this point. Improvement suggested by sebb.

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java?rev=1623872&r1=1623871&r2=1623872&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
Tue Sep  9 19:32:31 2014
@@ -1489,7 +1489,7 @@ public class NumberUtils {
             return false;
         }
         if( StringUtils.startsWith( str, "-" ) ) {
-            return isDigits( StringUtils.replaceOnce( StringUtils.substring( str, 1 ), ".",
StringUtils.EMPTY ) );
+            return isDigits( StringUtils.replaceOnce( str.substring(1), ".", StringUtils.EMPTY
) );
         } else {
             return isDigits( StringUtils.replaceOnce( str, ".", StringUtils.EMPTY ) );
         }



Mime
View raw message