| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Miscellaneous string utility methods. This class delivers some simple functionality that should really be provided by the core Java String and StringBuffer classes, such as the ability to replace all occurrences of a given substring in a target string. It also provides easy-to-use methods to convert between delimited strings, such as CSV strings, and collections and arrays.
| Method Summary | |
static String[] | addStringToArray(String[] arr, String s) |
static String | arrayToCommaDelimitedString(Object[] arr)Convenience method to return a String array as a CSV String. |
static String | arrayToDelimitedString(Object[] arr, String delim)Convenience method to return a String array as a delimited (e.g. |
static String | collectionToCommaDelimitedString(Collection c)Convenience method to return a Collection as a CSV String. |
static String | collectionToDelimitedString(Collection c, String delim)Convenience method to return a Collection as a delimited (e.g. |
static Set | commaDelimitedListToSet(String s)Convenience method to convert a CSV string list to a set. |
static String[] | commaDelimitedListToStringArray(String s)Convert a CSV list into an array of Strings. |
static int | countOccurrencesOf(String s, String sub)Count the occurrences of the substring in string s |
static String | delete(String inString, String pattern)Delete all occurrences of the given substring. |
static String | deleteAny(String inString, String chars)Delete any character in a given string. |
static String[] | delimitedListToStringArray(String s, String delimiter)Take a String which is a delimited list and convert it to a String array |
static String | replace(String inString, String oldPattern, String newPattern)Replaces all occurences of a substring within a string with another string. |
static String[] | tokenizeToStringArray(String s, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens)Tokenize the given String into a String array via a StringTokenizer. |
| Method Detail |
public static String[] addStringToArray(String[] arr, String s)
public static String arrayToCommaDelimitedString(Object[] arr)
public static String arrayToDelimitedString(Object[] arr, String delim)
public static String collectionToCommaDelimitedString(Collection c)
public static String collectionToDelimitedString(Collection c, String delim)
public static Set commaDelimitedListToSet(String s)
public static String[] commaDelimitedListToStringArray(String s)
public static int countOccurrencesOf(String s, String sub)
public static String delete(String inString, String pattern)
public static String deleteAny(String inString, String chars)
public static String[] delimitedListToStringArray(String s, String delimiter)
public static String replace(String inString, String oldPattern, String newPattern)
public static String[] tokenizeToStringArray(String s, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens)
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||