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 C61EA176ED for ; Mon, 27 Apr 2015 19:19:49 +0000 (UTC) Received: (qmail 313 invoked by uid 500); 27 Apr 2015 19:19:39 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 220 invoked by uid 500); 27 Apr 2015 19:19:39 -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 141 invoked by uid 99); 27 Apr 2015 19:19:39 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 19:19:39 +0000 Date: Mon, 27 Apr 2015 19:19:39 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1013) Adding to StringUtils truncate method and test cases 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-1013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14514739#comment-14514739 ] ASF GitHub Bot commented on LANG-1013: -------------------------------------- Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/24 > Adding to StringUtils truncate method and test cases > ---------------------------------------------------- > > Key: LANG-1013 > URL: https://issues.apache.org/jira/browse/LANG-1013 > Project: Commons Lang > Issue Type: New Feature > Components: lang.* > Reporter: Thiago Andrade > Assignee: Benedikt Ritter > Labels: github > Fix For: Review Patch > > > Adding the following methods from StringUtils: > * {{public static String truncate(final String str, final int maxWidth)}} > * {{public static String truncate(final String str, int offset, final int maxWidth)}} > For example > {code:java} > StringUtils.truncate("abcdefg", 4) = "abcd" > StringUtils.truncate("abcdefg", 6) = "abcdef" > StringUtils.truncate("abcdefg", 7) = "abcdefg" > StringUtils.truncate("abcdefg", 8) = "abcdefg" > StringUtils.truncate("abcdefghijklmno", -1, 10) = "abcdefghij" > StringUtils.truncate("abcdefghijklmno", 0, 10) = "abcdefghij" > StringUtils.truncate("abcdefghijklmno", Integer.MIN_VALUE, 10) = "abcdefghij" > StringUtils.truncate("abcdefghijklmno", Integer.MIN_VALUE, Integer.MAX_VALUE) = "abcdefghijklmno" > StringUtils.truncate("abcdefghijklmno", 0, Integer.MAX_VALUE) = "abcdefghijklmno" > StringUtils.truncate("abcdefghijklmno", 1, 10) = "bcdefghijk" > StringUtils.truncate("abcdefghijklmno", 2, 10) = "cdefghijkl" > StringUtils.truncate("abcdefghijklmno", 3, 10) = "defghijklm" > StringUtils.truncate("abcdefghijklmno", 4, 10) = "efghijklmn" > StringUtils.truncate("abcdefghijklmno", 5, 10) = "fghijklmno" > StringUtils.truncate("abcdefghijklmno", 5, 5) = "fghij" > StringUtils.truncate("abcdefghijklmno", 5, 3) = "fgh" > StringUtils.truncate("abcdefghijklmno", 10, 3) = "klm" > StringUtils.truncate("abcdefghijklmno", 10, Integer.MAX_VALUE) = "klmno" > StringUtils.truncate("abcdefghijklmno", 13, 1) = "n" > StringUtils.truncate("abcdefghijklmno", 13, Integer.MAX_VALUE) = "no" > StringUtils.truncate("abcdefghijklmno", 14, 1) = "o" > StringUtils.truncate("abcdefghijklmno", 14, Integer.MAX_VALUE) = "o" > {code} > See: https://github.com/apache/commons-lang/pull/24 -- This message was sent by Atlassian JIRA (v6.3.4#6332)