You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2014/09/09 21:32:32 UTC

svn commit: r1623872 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java

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 ) );
         }