[
https://issues.apache.org/jira/browse/LANG-1023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15509591#comment-15509591
]
ASF GitHub Bot commented on LANG-1023:
--------------------------------------
Github user marko-bekhta commented on a diff in the pull request:
https://github.com/apache/commons-lang/pull/179#discussion_r79809527
--- 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, <code>null</code> if null
input
*/
public static String wrap(final String str, int wrapLength, String
newLineStr, final boolean wrapLongWords) {
+ return wrap(str, wrapLength, newLineStr, wrapLongWords, " ");
+ }
+
+ /**
+ * <p>Wraps a single line of text, identifying words by <code>'
'</code>.</p>
+ *
+ * <p>Leading spaces on a new line are stripped.
+ * Trailing spaces are not stripped.</p>
+ *
+ * <table border="1" summary="Wrap Results">
+ * <tr>
+ * <th>input</th>
+ * <th>wrapLenght</th>
+ * <th>newLineString</th>
+ * <th>wrapLongWords</th>
--- End diff --
@britter Hi, I've made the requested changes. Can you take a look?
> 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)