|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.stringer.util.StringKit
Static methods for common String tasks.
| Field Summary | |
private static java.lang.String |
EMPTY_STRING
|
private static long |
initial_hash
|
private static java.lang.String |
LINE_SEPARATOR
The system line separator. |
private static long[] |
mix_master
|
| Constructor Summary | |
private |
StringKit()
This class has a private constructor to prevent it from being instantiated. |
| Method Summary | |
private static long |
buzhash(java.lang.StringBuffer arg)
|
static java.lang.String |
filterMultipleConsecutive(java.lang.String input,
java.lang.String filter)
Filters out multiple consecutive instances of a given string. |
static int |
indexOfDigit(java.lang.String s)
Returns the index of the first digit in s. |
static java.lang.String |
randomString(int length)
Returns a random lower case letter-only string with length
characters. |
private static java.lang.String |
removeAll(java.lang.String input,
java.lang.String filter)
Removes all instances of a given string from an input. |
static java.lang.String |
replace(java.lang.String str,
java.lang.String pattern,
java.lang.String replace)
Replaces all occurences of pattern in str by
replace. |
static java.lang.String |
replaceIgnoreCase(java.lang.String str,
java.lang.String pattern,
java.lang.String replace)
Same as replace(java.lang.String, java.lang.String, java.lang.String) except that character case is ignored. |
static java.lang.String |
splitAt(java.lang.String str,
java.lang.String separator)
Splits a string at the last occurence of a separator string and returns the remaining text. |
static java.lang.String |
strip(java.lang.String s)
Removes all characters from a string that are not letters. |
static java.lang.String |
tab(int level)
Returns a string consisting of the specified number of tab characters. |
static int[] |
toIntArray(java.lang.String value,
java.lang.String separators)
Convert a string to an array of integers. |
static java.util.List |
toList(java.lang.String value,
java.lang.String separators)
Create a linked list of strings, by breaking a source string into pieces at ever occurrence of characters in a separator string. |
static java.lang.String |
toString(java.util.Collection c,
java.lang.String separator)
Flatten a collection to a string with individual elements separated by separator |
static java.lang.String |
toString(int[] array,
java.lang.String separator)
Convert an array of integers into a delimiter separated String. |
static java.lang.String |
toString(java.lang.String[] array,
java.lang.String separator)
Concatenate an array of strings into a delimiter separated String. |
static java.lang.String[] |
toStringArray(java.lang.String value,
java.lang.String separators)
Convert a string to an array of strings. |
static java.util.List |
wordSplit(java.lang.String input)
Splits a string into words, breaking according to the whitespace rules in the Character class. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.lang.String LINE_SEPARATOR
private static final java.lang.String EMPTY_STRING
private static long[] mix_master
private static long initial_hash
| Constructor Detail |
private StringKit()
| Method Detail |
private static long buzhash(java.lang.StringBuffer arg)
public static java.lang.String replace(java.lang.String str,
java.lang.String pattern,
java.lang.String replace)
pattern in str by
replace.
str - characters in this string are replaced.pattern - the string to be replaced.replace - the "find" string is replaced with this string.
s
public static java.lang.String replaceIgnoreCase(java.lang.String str,
java.lang.String pattern,
java.lang.String replace)
replace(java.lang.String, java.lang.String, java.lang.String) except that character case is ignored.
pattern - the string to be replaced.replace - the "pattern" string is replaced with this string.
public static java.lang.String filterMultipleConsecutive(java.lang.String input,
java.lang.String filter)
input - the string to filter
filterChar
private static java.lang.String removeAll(java.lang.String input,
java.lang.String filter)
input - the string to filterfilter - the string to remove
filter removed
java.lang.StringIndexOutOfBoundsException - if there is malformed text in the input.public static java.lang.String tab(int level)
level - the number of tab characters requested.public static java.lang.String randomString(int length)
length
characters.
public static java.lang.String strip(java.lang.String s)
Character.
s - the string to be stripped
public static int indexOfDigit(java.lang.String s)
s.
s - the index of the first digit in this string is found.
public static java.lang.String splitAt(java.lang.String str,
java.lang.String separator)
str - the string to be split at the separatorseparator - the string at which the split will occur
separator is not found in stran
empty string is returned, else a new string containing the text to
the right of the separator is returned.
public static java.lang.String[] toStringArray(java.lang.String value,
java.lang.String separators)
separators.
For example, to break a string into words we break at every space,
linefeed, carriage return, form feed and tab character
toStringArray( s, "\t\n\f\r ");
note that this will not delete any control-characters found in the string.
public static int[] toIntArray(java.lang.String value,
java.lang.String separators)
throws java.lang.NumberFormatException
separators.
java.lang.NumberFormatException
public static java.util.List toList(java.lang.String value,
java.lang.String separators)
public static java.lang.String toString(int[] array,
java.lang.String separator)
public static java.lang.String toString(java.lang.String[] array,
java.lang.String separator)
public static java.lang.String toString(java.util.Collection c,
java.lang.String separator)
separator
c - the collection to be converted to a delimited string.separator - the string used to separate individual elements
in the resulting string.
public static java.util.List wordSplit(java.lang.String input)
input - the input to split
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||