You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2014/01/24 16:42:19 UTC
svn commit: r1561036 - in /commons/proper/lang/trunk/src:
changes/changes.xml main/java/org/apache/commons/lang3/text/WordUtils.java
Author: britter
Date: Fri Jan 24 15:42:19 2014
New Revision: 1561036
URL: http://svn.apache.org/r1561036
Log:
LANG-956: Improve JavaDoc of WordUtils.wrap methods
Modified:
commons/proper/lang/trunk/src/changes/changes.xml
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java
Modified: commons/proper/lang/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/changes/changes.xml?rev=1561036&r1=1561035&r2=1561036&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/lang/trunk/src/changes/changes.xml [utf-8] Fri Jan 24 15:42:19 2014
@@ -22,6 +22,7 @@
<body>
<release version="3.3" date="TBA" description="Bugfix and Feature release">
+ <action issue="LANG-956" type="update" dev="britter">Improve JavaDoc of WordUtils.wrap methods</action>
<action issue="LANG-944" type="add" dev="britter" due-to="Rekha Joshi">Add the Jaro-Winkler string distance algorithm to StringUtils</action>
<action issue="LANG-936" type="fix" dev="bayard" due-to="Yaniv Kunda, Eli Lindsey">StringUtils.getLevenshteinDistance with too big of a threshold returns wrong result</action>
<action issue="LANG-943" type="fix" dev="kinow">Test DurationFormatUtilsTest.testEdgeDuration fails in JDK 1.6, 1.7 and 1.8, BRST time zone</action>
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java?rev=1561036&r1=1561035&r2=1561036&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/WordUtils.java Fri Jan 24 15:42:19 2014
@@ -54,10 +54,40 @@ public class WordUtils {
* <p>Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.</p>
*
- * <pre>
- * WordUtils.wrap(null, *) = null
- * WordUtils.wrap("", *) = ""
- * </pre>
+ * <table border="1">
+ * <tr>
+ * <th>input</th>
+ * <th>wrapLenght</th>
+ * <th>result</th>
+ * </tr>
+ * <tr>
+ * <td>null</td>
+ * <td>*</td>
+ * <td>null</td>
+ * </tr>
+ * <tr>
+ * <td>""</td>
+ * <td>*</td>
+ * <td>""</td>
+ * </tr>
+ * <tr>
+ * <td>"Here is one line of text that is going to be wrapped after 20 columns."</td>
+ * <td>20</td>
+ * <td>"Here is one line of\ntext that is going\nto be wrapped after\n20 columns."</td>
+ * </tr>
+ * <tr>
+ * <td>"Click here to jump to the commons website - http://commons.apache.org"</td>
+ * <td>20</td>
+ * <td>"Click here to jump\nto the commons\nwebsite -\nhttp://commons.apache.org"</td>
+ * </tr>
+ * <tr>
+ * <td>"Click here, http://commons.apache.org, to jump to the commons website"</td>
+ * <td>20</td>
+ * <td>"Click here,\nhttp://commons.apache.org,\nto jump to the\ncommons website"</td>
+ * </tr>
+ * </table>
+ *
+ * (assuming that '\n' is the systems line separator)
*
* @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
@@ -72,11 +102,65 @@ public class WordUtils {
*
* <p>Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.</p>
- *
- * <pre>
- * WordUtils.wrap(null, *, *, *) = null
- * WordUtils.wrap("", *, *, *) = ""
- * </pre>
+ *
+ * <table border="1">
+ * <tr>
+ * <th>input</th>
+ * <th>wrapLenght</th>
+ * <th>newLineString</th>
+ * <th>wrapLongWords</th>
+ * <th>result</th>
+ * </tr>
+ * <tr>
+ * <td>null</td>
+ * <td>*</td>
+ * <td>*</td>
+ * <td>true/false</td>
+ * <td>null</td>
+ * </tr>
+ * <tr>
+ * <td>""</td>
+ * <td>*</td>
+ * <td>*</td>
+ * <td>true/false</td>
+ * <td>""</td>
+ * </tr>
+ * <tr>
+ * <td>"Here is one line of text that is going to be wrapped after 20 columns."</td>
+ * <td>20</td>
+ * <td>"\n"</td>
+ * <td>true/false</td>
+ * <td>"Here is one line of\ntext that is going\nto be wrapped after\n20 columns."</td>
+ * </tr>
+ * <tr>
+ * <td>"Here is one line of text that is going to be wrapped after 20 columns."</td>
+ * <td>20</td>
+ * <td>"<br />"</td>
+ * <td>true/false</td>
+ * <td>"Here is one line of<br />text that is going<br />to be wrapped after<br />20 columns."</td>
+ * </tr>
+ * <tr>
+ * <td>"Here is one line of text that is going to be wrapped after 20 columns."</td>
+ * <td>20</td>
+ * <td>null</td>
+ * <td>true/false</td>
+ * <td>"Here is one line of" + systemNewLine + "text that is going" + systemNewLine + "to be wrapped after" + systemNewLine + "20 columns."</td>
+ * </tr>
+ * <tr>
+ * <td>"Click here to jump to the commons website - http://commons.apache.org"</td>
+ * <td>20</td>
+ * <td>"\n"</td>
+ * <td>false</td>
+ * <td>"Click here to jump\nto the commons\nwebsite -\nhttp://commons.apache.org"</td>
+ * </tr>
+ * <tr>
+ * <td>"Click here to jump to the commons website - http://commons.apache.org"</td>
+ * <td>20</td>
+ * <td>"\n"</td>
+ * <td>true</td>
+ * <td>"Click here to jump\nto the commons\nwebsite -\nhttp://commons.apach\ne.org"</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