Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 2894 invoked from network); 2 Feb 2008 20:32:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Feb 2008 20:32:41 -0000 Received: (qmail 72902 invoked by uid 500); 2 Feb 2008 20:32:31 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 72840 invoked by uid 500); 2 Feb 2008 20:32:31 -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 72831 invoked by uid 99); 2 Feb 2008 20:32:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2008 12:32:31 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2008 20:32:16 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 72886714048 for ; Sat, 2 Feb 2008 12:32:08 -0800 (PST) Message-ID: <15022119.1201984328465.JavaMail.jira@brutus> Date: Sat, 2 Feb 2008 12:32:08 -0800 (PST) From: "Gregor B. Rosenauer (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (LANG-405) StringUtils.truncate() to cut out middle part of a String In-Reply-To: <12720548.1201881908880.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LANG-405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565113#action_12565113 ] Gregor B. Rosenauer commented on LANG-405: ------------------------------------------ Thanks for looking into this little feature request:) @Henri: Yes, in BeOS this function was used to shorten filenames for display in the desktop filemanager, Tracker, and was available in the standard API. It was a cool feature, like most other aspects of the BeOS, way ahead of its time,-) @Sebb: good question, I think it would be way too much effort to put in word or even sentence recognition (which words or sentences make sense in which language etc.). I would be happy enough to have an equal number of characters at each side. This would be enough for the main use cases I encountered so far: 1. there are multiple Strings and cutting off the beginning/end of a String is not enough to differentiate them, like in user interfaces (tables etc.). 2. you need an excerpt of a String that is too big as a whole, e.g. logging an XML-document where the beginning/end is both interesting but the middle part is big and not needed as a whole > StringUtils.truncate() to cut out middle part of a String > --------------------------------------------------------- > > Key: LANG-405 > URL: https://issues.apache.org/jira/browse/LANG-405 > Project: Commons Lang > Issue Type: New Feature > Affects Versions: 2.2 > Reporter: Gregor B. Rosenauer > Priority: Minor > > It would be handy to have a String method that cuts out the middle part of a String such that as much as possible is kept from the start and end of the String, but the middle part is replaced by an ellipsis "..." > BeOS had a function like this, but it's poorly documented, missing examples: > http://www.beunited.org/bebook/The%20Support%20Kit/String.html#Truncate() > e.g.: > A very long text with unimportant stuff in the middle but interesting start and end to see if the text is complete. > becomes: > A very long text...to see if the text is complete. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.