scolebourne 2003/07/20 07:47:29
Modified: lang/src/test/org/apache/commons/lang StringUtilsTest.java
lang/src/java/org/apache/commons/lang StringUtils.java
Log:
Add summary javadoc section to StringUtils class
Rename reverseDelimitedString to reverseDelimited
Revision Changes Path
1.33 +7 -7
jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java
Index: StringUtilsTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- StringUtilsTest.java 20 Jul 2003 10:29:21 -0000 1.32
+++ StringUtilsTest.java 20 Jul 2003 14:47:29 -0000 1.33
@@ -704,12 +704,12 @@
assertEquals("sdrawkcab", StringUtils.reverse("backwards") );
}
- public void testReverseDelimitedString_StringChar() {
- assertEquals(null, StringUtils.reverseDelimitedString(null, '.') );
- assertEquals("", StringUtils.reverseDelimitedString("", '.') );
- assertEquals("c.b.a", StringUtils.reverseDelimitedString("a.b.c", '.') );
- assertEquals("a b c", StringUtils.reverseDelimitedString("a b c", '.') );
- assertEquals("", StringUtils.reverseDelimitedString("", '.') );
+ public void testReverseDelimited_StringChar() {
+ assertEquals(null, StringUtils.reverseDelimited(null, '.') );
+ assertEquals("", StringUtils.reverseDelimited("", '.') );
+ assertEquals("c.b.a", StringUtils.reverseDelimited("a.b.c", '.') );
+ assertEquals("a b c", StringUtils.reverseDelimited("a b c", '.') );
+ assertEquals("", StringUtils.reverseDelimited("", '.') );
}
public void testReverseDelimitedString_StringString() {
1.72 +54 -8
jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java
Index: StringUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- StringUtils.java 20 Jul 2003 10:29:22 -0000 1.71
+++ StringUtils.java 20 Jul 2003 14:47:29 -0000 1.72
@@ -60,6 +60,51 @@
/**
* <p>Common <code>String</code> manipulation routines that are
* <code>null</code> safe.</p>
+ *
+ * <ul>
+ * <li><b>IsEmpty/IsBlank</b>
+ * - checks if a String contains text
+ * <li><b>Trim/Strip</b>
+ * - remove leading and trailing whitespace
+ * <li><b>Equals</b>
+ * - compare two strings null-safe
+ * <li><b>IndexOf/LastIndexOf/Contains</b>
+ * - null-safe index of checks
+ * <li><b>IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut</b>
+ * - index of any of a set of Strings
+ * <li><b>ContainsOnly/ContainsNone</b>
+ * - does String contain only/none of these characters
+ * <li><b>SubString/Left/Right/Mid</b>
+ * - null-safe substring extraction
+ * <li><b>Split</b>
+ * - splits a String into an array of subtrings based on a separator
+ * <li><b>Join/Concatenate</b>
+ * - joins an array of Strings into one with optional separator
+ * <li><b>Replace/Delete/Overlay</b>
+ * - Searches a String and replaces one String with another
+ * <li><b>Chomp/Chop/Slice</b>
+ * - searches a String and returns the substring before/after the separator
+ * <li><b>LeftPad/RightPad/Center/Repeat</b>
+ * - pads a String
+ * <li><b>UpperCase/LowerCase/SwapCase/Capitalise/Uncapitalise</b>
+ * - change the case of a String
+ * <li><b>NestedString</b>
+ * - returns a substring nested within other Strings
+ * <li><b>CountMatches</b>
+ * - counts the number of occurrances of one String in another
+ * <li><b>IsAlpha/IsNumeric/IsWhitespace</b>
+ * - checks the characters in a String
+ * <li><b>DefaultString</b>
+ * - protects against a null input String
+ * <li><b>Reverse/ReverseDelimited</b>
+ * - reverses a String
+ * <li><b>Abbreviate</b>
+ * - abbreviates a string using ellipsis
+ * <li><b>Difference</b>
+ * - compares two Strings and reports on their differences
+ * <li><b>LevensteinDistance</b>
+ * - the number of changes needed to change one String into another
+ * </ul>
*
* <p>The <code>StringUtils</code> class defines certain words related to
* String handling.</p>
@@ -67,8 +112,9 @@
* <ul>
* <li>null - <code>null</code>
* <li>empty - a zero-length string (<code>""</code>)
- * <li>space - the space character (<code>' '</code>)(32)
+ * <li>space - the space character (<code>' '</code>)(char 32)
* <li>whitespace - the characters defined by [EMAIL PROTECTED]
Character#isWhitespace(char)}
+ * <li>trim - the characters <= 32 as in [EMAIL PROTECTED] String#trim(String)}
* </ul>
*
* <p><code>StringUtils</code> handles <code>null</code> input Strings quietly.
@@ -3335,17 +3381,17 @@
* is <code>'.'</code>).</p>
*
* <pre>
- * StringUtils.reverseDelimitedString(null, '.') = null
- * StringUtils.reverseDelimitedString("", '.') = ""
- * StringUtils.reverseDelimitedString("a.b.c", 'x') = "a.b.c"
- * StringUtils.reverseDelimitedString("a.b.c", ".") = "c.b.a"
+ * StringUtils.reverseDelimited(null, '.') = null
+ * StringUtils.reverseDelimited("", '.') = ""
+ * StringUtils.reverseDelimited("a.b.c", 'x') = "a.b.c"
+ * StringUtils.reverseDelimited("a.b.c", ".") = "c.b.a"
* </pre>
*
* @param str the String to reverse, may be null
* @param separatorChar the separator character to use
* @return the reversed String, <code>null</code> if null String input
*/
- public static String reverseDelimitedString(String str, char separatorChar) {
+ public static String reverseDelimited(String str, char separatorChar) {
if (str == null) {
return null;
}
@@ -3373,7 +3419,7 @@
* @param str the String to reverse, may be null
* @param separatorChars the separator characters to use, null treated as
whitespace
* @return the reversed String, <code>null</code> if null String input
- * @deprecated Use [EMAIL PROTECTED] #reverseDelimitedString(String, char)}
instead.
+ * @deprecated Use [EMAIL PROTECTED] #reverseDelimited(String, char)} instead.
* This method is broken as the join doesn't know which char to use.
* Method will be removed in Commons Lang 3.0.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]