Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5DA56200B99 for ; Tue, 20 Sep 2016 18:13:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5C3D0160AC5; Tue, 20 Sep 2016 16:13:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A2A74160AC0 for ; Tue, 20 Sep 2016 18:13:21 +0200 (CEST) Received: (qmail 16013 invoked by uid 500); 20 Sep 2016 16:13:20 -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 15992 invoked by uid 99); 20 Sep 2016 16:13:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2016 16:13:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 89CAA2C2A68 for ; Tue, 20 Sep 2016 16:13:20 +0000 (UTC) Date: Tue, 20 Sep 2016 16:13:20 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1023) WordUtils.wrap: Customizable breakable characters (not just space/whitespace) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 20 Sep 2016 16:13:22 -0000 [ https://issues.apache.org/jira/browse/LANG-1023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15506989#comment-15506989 ] ASF GitHub Bot commented on LANG-1023: -------------------------------------- Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/179#discussion_r79649084 --- Diff: src/main/java/org/apache/commons/lang3/text/WordUtils.java --- @@ -172,6 +173,84 @@ public static String wrap(final String str, final int wrapLength) { * @return a line with newlines inserted, null if null input */ public static String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords) { + return wrap(str, wrapLength, newLineStr, wrapLongWords, " "); + } + + /** + *

Wraps a single line of text, identifying words by ' '.

+ * + *

Leading spaces on a new line are stripped. + * Trailing spaces are not stripped.

+ * + * + * + * + * + * + * --- End diff -- The table is a column for the `wrapOn` parameter > WordUtils.wrap: Customizable breakable characters (not just space/whitespace) > ----------------------------------------------------------------------------- > > Key: LANG-1023 > URL: https://issues.apache.org/jira/browse/LANG-1023 > Project: Commons Lang > Issue Type: Wish > Components: lang.text.* > Affects Versions: 3.3.2 > Reporter: Andrew Pennebaker > Labels: word,wrap,word-wrap, > Fix For: Review Patch > > > WordUtils.wrap is good at what it does, but I want slightly different semantics. I would like the option to set different characters for word breaking, not just space or whitespace, but punctuation marks. > The current implementation wraps like this: > flammable/inflammable [original string] > flammable/inflammable [wrap with large widths] > flammable/inflammable [wrap with wrapLongWords = false] > flammable/inflam [wrap with wrapLongWords = true] > mable > I would like to configure wrap to break "flammable/inflammable" on punctuation marks as well as whitespace, so that it wraps like this: > flammable/ [wrap with additionalBreakCharacters = "/+-"] > inflammable -- This message was sent by Atlassian JIRA (v6.3.4#6332)
inputwrapLenghtnewLineStringwrapLongWords