dlr 01/08/25 18:04:24
Modified: util/src/java/org/apache/commons/util StringUtils.java
Log:
On Bay's agreement, removed the implode/explode class methods. The
more Perl-like names seem more descriptive of the type of processing
occurring in the methods. Bay indicates the the implode/explode names
had their roots in LPC (a C-like object language).
Revision Changes Path
1.8 +6 -72
jakarta-commons-sandbox/util/src/java/org/apache/commons/util/StringUtils.java
Index: StringUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/util/src/java/org/apache/commons/util/StringUtils.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -u -r1.7 -r1.8
--- StringUtils.java 2001/08/24 22:34:59 1.7
+++ StringUtils.java 2001/08/26 01:04:24 1.8
@@ -77,7 +77,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Greg Coladonato</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bayard</a>
- * @version $Id: StringUtils.java,v 1.7 2001/08/24 22:34:59 dlr Exp $
+ * @version $Id: StringUtils.java,v 1.8 2001/08/26 01:04:24 dlr Exp $
*/
public class StringUtils
{
@@ -477,72 +477,6 @@
*/
/**
- * Merge an array of Objects into a list of delimited
- * Strings. No delimiter is added before or after the list.
- *
- * @param objs Object[] to put into String list form
- * @param sep String delimiter
- *
- * @return String delimited list of the passed in object's toStrings.
- * @deprecated Use join(Object[], String) instead.
- */
- static public String implode(Object[] objs, String sep) {
- return join(objs, sep);
- }
-
-
- /**
- * Merge an Iterator of Objects into a list of delimited
- * Strings. No delimiter is added before or after the list.
- *
- * @param objs Object[] to put into String list form
- * @param sep String delimiter
- *
- * @return String delimited list of the passed in object's toStrings.
- * @deprecated Use join(Iterator, String) instead.
- */
- static public String implode(Iterator iterator, String sep) {
- return join(iterator, sep);
- }
-
- /**
- * @deprecated Use split(String) instead.
- */
- static public String[] explode(String str) {
- return split(str, " ", -1);
- }
-
- /**
- * @deprecated Use split(String, String) instead.
- */
- static public String[] explode(String str, String sep) {
- return split(str, sep, -1);
- }
-
- /**
- * @deprecated Use split(String, String, int) instead.
- */
- static public String[] explode(String str, String sep, String n) {
- return explode(str,sep,NumberUtils.stringToInt(n, -1));
- }
-
- /**
- * Turn a separated string into an array of Strings.
- * A maximum length for the returned array may be passed in.
- * A max length of -1 implies that there need be no limit.
- *
- * @param str String to separate
- * @param sep String separator
- * @param n int max length of the array
- * @return String[] of separated Strings
- * @deprecated Use split(String, String, int) instead.
- */
- static public String[] explode(String str, String sep, int n) {
- return split(str, sep, n);
- }
-
-
- /**
* Uncapitalise a string. That is, convert the first character into
* lower-case.
*
@@ -1799,9 +1733,11 @@
}
return buffer.toString();
}
+
static public String random(int count, String set) {
return random(count, set.toCharArray());
}
+
static public String random(int count, char[] set) {
return random(count,0,set.length-1,false,false,set);
}
@@ -1809,14 +1745,13 @@
static public String reverseDottedName(String text) {
return reverseDelimitedString(text, ".");
}
+
static public String reverseDelimitedString(String text, String delimiter) {
// could implement manually, but simple way is to reuse other,
// probably slower, methods.
- String[] strs = explode(text, delimiter);
-
+ String[] strs = split(text, delimiter);
CollectionsUtils.reverseArray(strs);
-
- return implode(strs, delimiter);
+ return join(strs, delimiter);
}
/**
@@ -1834,7 +1769,6 @@
}
return text;
}
-
}