Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BADFA17342 for ; Sun, 26 Oct 2014 17:26:34 +0000 (UTC) Received: (qmail 68986 invoked by uid 500); 26 Oct 2014 17:26:33 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 68863 invoked by uid 500); 26 Oct 2014 17:26:33 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 68852 invoked by uid 99); 26 Oct 2014 17:26:33 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Oct 2014 17:26:33 +0000 Date: Sun, 26 Oct 2014 17:26:33 +0000 (UTC) From: "Bernd Eckenfels (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1058) StringUtils.uncapitalize performance improvement MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-1058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14184553#comment-14184553 ] Bernd Eckenfels commented on LANG-1058: --------------------------------------- Do you mean the possible improvement of skipping one char operation, like: {code} public static String uncapitalize(final String str) { int strLen; if (str == null || (strLen = str.length()) == 0) { return str; } final char firstChar = str.charAt(0); final char newChar = Character.toLowerCase(firstChar); if (firstChar == newChar) { // already uncapitalized return str; } return new StringBuilder(strLen) .append(newChar) .append(str.substring(1)) .toString(); } {code} (I dont think repacing Stringbuilder with ""+"" is a good thing here as we know the target string size and can optimize for it) > StringUtils.uncapitalize performance improvement > ------------------------------------------------ > > Key: LANG-1058 > URL: https://issues.apache.org/jira/browse/LANG-1058 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* > Reporter: Leo Wang > -- This message was sent by Atlassian JIRA (v6.3.4#6332)