Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E1CF11163 for ; Tue, 9 Sep 2014 19:32:54 +0000 (UTC) Received: (qmail 16801 invoked by uid 500); 9 Sep 2014 19:32:53 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 16714 invoked by uid 500); 9 Sep 2014 19:32:53 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 16705 invoked by uid 99); 9 Sep 2014 19:32:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 19:32:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 19:32:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 14CD623888FE; Tue, 9 Sep 2014 19:32:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: britter@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140909193232.14CD623888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 ) ); }