LANG-1023 WordUtils.wrap: Customizable breakable characters (not just space/whitespace)
updated JavaDoc Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/78c373d7 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/78c373d7 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/78c373d7 Branch: refs/heads/master Commit: 78c373d7bc23e81c82cac6feb66a9f6b9472f8ab Parents: 0fe9685 Author: marko-bekhta <mar...@prykladna.lviv.ua> Authored: Tue Sep 20 19:46:50 2016 +0200 Committer: marko-bekhta <mar...@prykladna.lviv.ua> Committed: Tue Sep 20 19:46:50 2016 +0200 ---------------------------------------------------------------------- .../org/apache/commons/lang3/text/WordUtils.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/78c373d7/src/main/java/org/apache/commons/lang3/text/WordUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/text/WordUtils.java b/src/main/java/org/apache/commons/lang3/text/WordUtils.java index 9e04962..a85f28f 100644 --- a/src/main/java/org/apache/commons/lang3/text/WordUtils.java +++ b/src/main/java/org/apache/commons/lang3/text/WordUtils.java @@ -177,7 +177,7 @@ public class WordUtils { } /** - * <p>Wraps a single line of text, identifying words by <code>' '</code>.</p> + * <p>Wraps a single line of text, identifying words by <code>wrapOn</code>.</p> * * <p>Leading spaces on a new line are stripped. * Trailing spaces are not stripped.</p> @@ -188,6 +188,7 @@ public class WordUtils { * <th>wrapLenght</th> * <th>newLineString</th> * <th>wrapLongWords</th> + * <th>wrapOn</th> * <th>result</th> * </tr> * <tr> @@ -195,6 +196,7 @@ public class WordUtils { * <td>*</td> * <td>*</td> * <td>true/false</td> + * <td>*</td> * <td>null</td> * </tr> * <tr> @@ -202,6 +204,7 @@ public class WordUtils { * <td>*</td> * <td>*</td> * <td>true/false</td> + * <td>*</td> * <td>""</td> * </tr> * <tr> @@ -209,6 +212,7 @@ public class WordUtils { * <td>20</td> * <td>"\n"</td> * <td>true/false</td> + * <td>" "</td> * <td>"Here is one line of\ntext that is going\nto be wrapped after\n20 columns."</td> * </tr> * <tr> @@ -216,6 +220,7 @@ public class WordUtils { * <td>20</td> * <td>"<br />"</td> * <td>true/false</td> + * <td>" "</td> * <td>"Here is one line of<br />text that is going<br />to be wrapped after<br />20 columns."</td> * </tr> * <tr> @@ -223,6 +228,7 @@ public class WordUtils { * <td>20</td> * <td>null</td> * <td>true/false</td> + * <td>" "</td> * <td>"Here is one line of" + systemNewLine + "text that is going" + systemNewLine + "to be wrapped after" + systemNewLine + "20 columns."</td> * </tr> * <tr> @@ -230,6 +236,7 @@ public class WordUtils { * <td>20</td> * <td>"\n"</td> * <td>false</td> + * <td>" "</td> * <td>"Click here to jump\nto the commons\nwebsite -\nhttp://commons.apache.org"</td> * </tr> * <tr> @@ -237,10 +244,18 @@ public class WordUtils { * <td>20</td> * <td>"\n"</td> * <td>true</td> + * <td>" "</td> * <td>"Click here to jump\nto the commons\nwebsite -\nhttp://commons.apach\ne.org"</td> * </tr> + * <tr> + * <td>"flammable/inflammable"</td> + * <td>20</td> + * <td>"\n"</td> + * <td>true</td> + * <td>"/"</td> + * <td>"flammable/inflammable"</td> + * </tr> * </table> - * * @param str the String to be word wrapped, may be null * @param wrapLength the column to wrap the words at, less than 1 is treated as 1 * @param newLineStr the string to insert for a new line,