ggregory 2003/08/20 22:57:21
Modified: lang/src/java/org/apache/commons/lang StringUtils.java
Log:
Add @since 2.0 tags based on http://www.apache.org/~bayard/commons-lang-2.0/Commons-Lang-1.0.1-to-2.0/missingSinces.txt
Revision Changes Path
1.104 +49 -1 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.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- StringUtils.java 19 Aug 2003 00:11:20 -0000 1.103
+++ StringUtils.java 21 Aug 2003 05:57:21 -0000 1.104
@@ -166,6 +166,7 @@
/**
* The empty String "".
+ * @since 2.0
*/
public static final String EMPTY = "";
@@ -252,6 +253,7 @@
*
* @param str the String to check, may be null
* @return true if the String is null, empty or whitespace
+ * @since 2.0
*/
public static boolean isBlank(String str) {
int strLen;
@@ -280,6 +282,7 @@
* @param str the String to check, may be null
* @return true if the String is
* not empty and not null and not whitespace
+ * @since 2.0
*/
public static boolean isNotBlank(String str) {
int strLen;
@@ -366,6 +369,7 @@
* @param str the String to be trimmed, may be null
* @return the trimmed String,
* null if only chars <= 32, empty or null String input
+ * @since 2.0
*/
public static String trimToNull(String str) {
String ts = trim(str);
@@ -391,6 +395,7 @@
*
* @param str the String to be trimmed, may be null
* @return the trimmed String, or an empty String if null input
+ * @since 2.0
*/
public static String trimToEmpty(String str) {
return (str == null ? EMPTY : str.trim());
@@ -445,6 +450,7 @@
* @param str the String to be stripped, may be null
* @return the stripped String,
* null if whitespace, empty or null String input
+ * @since 2.0
*/
public static String stripToNull(String str) {
if (str == null) {
@@ -474,6 +480,7 @@
*
* @param str the String to be stripped, may be null
* @return the trimmed String, or an empty String if null input
+ * @since 2.0
*/
public static String stripToEmpty(String str) {
return (str == null ? EMPTY : strip(str, null));
@@ -733,6 +740,7 @@
* @param searchChar the character to find
* @return the first index of the search character,
* -1 if no match or null string input
+ * @since 2.0
*/
public static int indexOf(String str, char searchChar) {
if (str == null || str.length() == 0) {
@@ -764,6 +772,7 @@
* @param startPos the start position, negative treated as zero
* @return the first index of the search character,
* -1 if no match or null string input
+ * @since 2.0
*/
public static int indexOf(String str, char searchChar, int startPos) {
if (str == null || str.length() == 0) {
@@ -792,6 +801,7 @@
* @param searchStr the String to find, may be null
* @return the first index of the search String,
* -1 if no match or null string input
+ * @since 2.0
*/
public static int indexOf(String str, String searchStr) {
if (str == null || searchStr == null) {
@@ -829,6 +839,7 @@
* @param startPos the start position, negative treated as zero
* @return the first index of the search String,
* -1 if no match or null string input
+ * @since 2.0
*/
public static int indexOf(String str, String searchStr, int startPos) {
if (str == null || searchStr == null) {
@@ -860,6 +871,7 @@
* @param searchChar the character to find
* @return the last index of the search character,
* -1 if no match or null string input
+ * @since 2.0
*/
public static int lastIndexOf(String str, char searchChar) {
if (str == null || str.length() == 0) {
@@ -893,6 +905,7 @@
* @param startPos the start position
* @return the last index of the search character,
* -1 if no match or null string input
+ * @since 2.0
*/
public static int lastIndexOf(String str, char searchChar, int startPos) {
if (str == null || str.length() == 0) {
@@ -921,6 +934,7 @@
* @param searchStr the String to find, may be null
* @return the last index of the search String,
* -1 if no match or null string input
+ * @since 2.0
*/
public static int lastIndexOf(String str, String searchStr) {
if (str == null || searchStr == null) {
@@ -955,6 +969,7 @@
* @param startPos the start position, negative treated as zero
* @return the first index of the search String,
* -1 if no match or null string input
+ * @since 2.0
*/
public static int lastIndexOf(String str, String searchStr, int startPos) {
if (str == null || searchStr == null) {
@@ -982,6 +997,7 @@
* @param searchChar the character to find
* @return true if the String contains the search character,
* false if not or null string input
+ * @since 2.0
*/
public static boolean contains(String str, char searchChar) {
if (str == null || str.length() == 0) {
@@ -1009,6 +1025,7 @@
* @param searchStr the String to find, may be null
* @return true if the String contains the search character,
* false if not or null string input
+ * @since 2.0
*/
public static boolean contains(String str, String searchStr) {
if (str == null || searchStr == null) {
@@ -1039,6 +1056,7 @@
* @param str the String to check, may be null
* @param searchChars the chars to search for, may be null
* @return the index of any of the chars, -1 if no match or null input
+ * @since 2.0
*/
public static int indexOfAny(String str, char[] searchChars) {
if (str == null || str.length() == 0 || searchChars == null || searchChars.length == 0) {
@@ -1075,6 +1093,7 @@
* @param str the String to check, may be null
* @param searchChars the chars to search for, may be null
* @return the index of any of the chars, -1 if no match or null input
+ * @since 2.0
*/
public static int indexOfAny(String str, String searchChars) {
if (str == null || str.length() == 0 || searchChars == null || searchChars.length() == 0) {
@@ -1105,6 +1124,7 @@
* @param str the String to check, may be null
* @param searchChars the chars to search for, may be null
* @return the index of any of the chars, -1 if no match or null input
+ * @since 2.0
*/
public static int indexOfAnyBut(String str, char[] searchChars) {
if (str == null || str.length() == 0 || searchChars == null || searchChars.length == 0) {
@@ -1142,6 +1162,7 @@
* @param str the String to check, may be null
* @param searchChars the chars to search for, may be null
* @return the index of any of the chars, -1 if no match or null input
+ * @since 2.0
*/
public static int indexOfAnyBut(String str, String searchChars) {
if (str == null || str.length() == 0 || searchChars == null || searchChars.length() == 0) {
@@ -1212,6 +1233,7 @@
* @param str the String to check, may be null
* @param validChars a String of valid chars, may be null
* @return true if it only contains valid chars and is non-null
+ * @since 2.0
*/
public static boolean containsOnly(String str, String validChars) {
if (str == null || validChars == null) {
@@ -1242,6 +1264,7 @@
* @param str the String to check, may be null
* @param invalidChars an array of invalid chars, may be null
* @return true if it contains none of the invalid chars, or is null
+ * @since 2.0
*/
public static boolean containsNone(String str, char[] invalidChars) {
if (str == null || invalidChars == null) {
@@ -1280,6 +1303,7 @@
* @param str the String to check, may be null
* @param invalidChars a String of invalid chars, may be null
* @return true if it contains none of the invalid chars, or is null
+ * @since 2.0
*/
public static boolean containsNone(String str, String invalidChars) {
if (str == null || invalidChars == null) {
@@ -1639,6 +1663,7 @@
* @param separator the String to search for, may be null
* @return the substring before the first occurance of the separator,
* null if null String input
+ * @since 2.0
*/
public static String substringBefore(String str, String separator) {
if (str == null || separator == null || str.length() == 0) {
@@ -1678,6 +1703,7 @@
* @param separator the String to search for, may be null
* @return the substring after the first occurance of the separator,
* null if null String input
+ * @since 2.0
*/
public static String substringAfter(String str, String separator) {
if (str == null || str.length() == 0) {
@@ -1716,6 +1742,7 @@
* @param separator the String to search for, may be null
* @return the substring before the last occurance of the separator,
* null if null String input
+ * @since 2.0
*/
public static String substringBeforeLast(String str, String separator) {
if (str == null || separator == null || str.length() == 0 || separator.length() == 0) {
@@ -1753,6 +1780,7 @@
* @param separator the String to search for, may be null
* @return the substring after the last occurance of the separator,
* null if null String input
+ * @since 2.0
*/
public static String substringAfterLast(String str, String separator) {
if (str == null || str.length() == 0) {
@@ -1789,6 +1817,7 @@
* @param str the String containing the substring, may be null
* @param tag the String before and after the substring, may be null
* @return the substring, null if no match
+ * @since 2.0
*/
public static String substringBetween(String str, String tag) {
return substringBetween(str, tag, tag);
@@ -1817,6 +1846,7 @@
* @param open the String before the substring, may be null
* @param close the String after the substring, may be null
* @return the substring, null if no match
+ * @since 2.0
*/
public static String substringBetween(String str, String open, String close) {
if (str == null || open == null || close == null) {
@@ -1940,6 +1970,7 @@
* @param separatorChar the character used as the delimiter,
* null splits on whitespace
* @return an array of parsed Strings, null if null String input
+ * @since 2.0
*/
public static String[] split(String str, char separatorChar) {
// Performance tuned for 2.0 (JDK1.4)
@@ -2143,6 +2174,7 @@
*
* @param array the array of values to join together, may be null
* @return the joined String, null if null array input
+ * @since 2.0
*/
public static String join(Object[] array) {
return join(array, null);
@@ -2168,6 +2200,7 @@
* @param array the array of values to join together, may be null
* @param separator the separator character to use
* @return the joined String, null if null array input
+ * @since 2.0
*/
public static String join(Object[] array, char separator) {
if (array == null) {
@@ -2253,6 +2286,7 @@
* @param iterator the Iterator of values to join together, may be null
* @param separator the separator character to use
* @return the joined String, null if null iterator input
+ * @since 2.0
*/
public static String join(Iterator iterator, char separator) {
if (iterator == null) {
@@ -2483,6 +2517,7 @@
* @param searchChar the character to search for, may be null
* @param replaceChar the character to replace, may be null
* @return modified String, null if null string input
+ * @since 2.0
*/
public static String replaceChars(String str, char searchChar, char replaceChar) {
if (str == null) {
@@ -2525,6 +2560,7 @@
* @param searchChars a set of characters to search for, may be null
* @param replaceChars a set of characters to replace, may be null
* @return modified String, null if null string input
+ * @since 2.0
*/
public static String replaceChars(String str, String searchChars, String replaceChars) {
if (str == null || str.length() == 0 || searchChars == null || searchChars.length()== 0) {
@@ -2624,6 +2660,7 @@
* @param start the position to start overlaying at
* @param end the position to stop overlaying before
* @return overlayed String, null if null String input
+ * @since 2.0
*/
public static String overlay(String str, String overlay, int start, int end) {
if (str == null) {
@@ -3077,6 +3114,7 @@
* @param padChar the character to pad with
* @return right padded String or original String if no padding is necessary,
* null if null String input
+ * @since 2.0
*/
public static String rightPad(String str, int size, char padChar) {
if (str == null) {
@@ -3188,6 +3226,7 @@
* @param padChar the character to pad with
* @return left padded String or original String if no padding is necessary,
* null if null String input
+ * @since 2.0
*/
public static String leftPad(String str, int size, char padChar) {
if (str == null) {
@@ -3308,6 +3347,7 @@
* @param size the int size of new String, negative treated as zero
* @param padChar the character to pad the new String with
* @return centered String, null if null String input
+ * @since 2.0
*/
public static String center(String str, int size, char padChar) {
if (str == null || size <= 0) {
@@ -3428,6 +3468,7 @@
* @return the capitalized String, null if null String input
* @see WordUtils#capitalize(String)
* @see #uncapitalize(String)
+ * @since 2.0
*/
public static String capitalize(String str) {
int strLen;
@@ -3471,6 +3512,7 @@
* @return the uncapitalized String, null if null String input
* @see WordUtils#uncapitalize(String)
* @see #capitalize(String)
+ * @since 2.0
*/
public static String uncapitalize(String str) {
int strLen;
@@ -3819,6 +3861,7 @@
*
* @param str the String to check, may be null
* @return true if only contains whitespace, and is non-null
+ * @since 2.0
*/
public static boolean isWhitespace(String str) {
if (str == null) {
@@ -3916,6 +3959,7 @@
* @param str the String to reverse, may be null
* @param separatorChar the separator character to use
* @return the reversed String, null if null String input
+ * @since 2.0
*/
public static String reverseDelimited(String str, char separatorChar) {
if (str == null) {
@@ -3996,6 +4040,7 @@
* @param maxWidth maximum length of result String, must be at least 4
* @return abbreviated String, null if null String input
* @throws IllegalArgumentException if the width is too small
+ * @since 2.0
*/
public static String abbreviate(String str, int maxWidth) {
return abbreviate(str, 0, maxWidth);
@@ -4034,6 +4079,7 @@
* @param maxWidth maximum length of result String, must be at least 4
* @return abbreviated String, null if null String input
* @throws IllegalArgumentException if the width is too small
+ * @since 2.0
*/
public static String abbreviate(String str, int offset, int maxWidth) {
if (str == null) {
@@ -4088,6 +4134,7 @@
* @param str2 the second String, may be null
* @return the portion of str2 where it differs from str1; returns the
* empty String if they are equal
+ * @since 2.0
*/
public static String difference(String str1, String str2) {
if (str1 == null) {
@@ -4124,6 +4171,7 @@
* @param str1 the first String, may be null
* @param str2 the second String, may be null
* @return the index where str2 and str1 begin to differ; -1 if they are equal
+ * @since 2.0
*/
public static int differenceAt(String str1, String str2) {
if (str1 == str2) {