|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bluemarsh.jswat.util.StringUtils
Provides utility methods for handling Strings.
Field Summary | |
protected static java.lang.String[] |
zeros
Array of zeros for padding numbers. |
Constructor Summary | |
StringUtils()
|
Method Summary | |
static java.lang.String |
cleanForPrinting(java.lang.String input,
int maxLen)
Substitute the slash escaped printable characters with the escaped equivalents, so the string can be displayed properly. |
static int |
indexOfUnescaped(java.lang.String s,
char c)
Returns the index within this string of the first occurrence of the specified character, not preceeded by a forward slash (\). |
static int |
indexOfUnescaped(java.lang.String s,
int ch,
int fromIndex)
Returns the index within this string of the first occurrence of the specified character, not preceeded by a forward slash (\), starting the search at the specified index. |
static java.lang.String |
listToString(java.util.List list)
Converts the list to a comma-separated String of values. |
static java.util.List |
stringToList(java.lang.String str)
Converts the String of comma-separated values to a list of String elements. |
static java.lang.String |
toHexString(int i)
Converts the given integer to a four-digit, hexadecimal string, padding with zeros as needed. |
static java.lang.String[] |
tokenize(java.lang.String input)
Take the given string and chop it up into a series of strings on whitespace boundries. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.lang.String[] zeros
Constructor Detail |
public StringUtils()
Method Detail |
public static java.lang.String cleanForPrinting(java.lang.String input, int maxLen)
input
- string to be processed (may be null).maxLen
- maximum length of output string; 0 for no limit.public static int indexOfUnescaped(java.lang.String s, char c)
ch
occurs in the character
sequence represented by this String
object, then the
index of the first such occurrence is returned -- that is, the
smallest value k such that:
isthis.charAt(k) == ch
true
. If no such character occurs in this string,
then -1
is returned.s
- the string.ch
- a character.-1
if the character does not occur.public static int indexOfUnescaped(java.lang.String s, int ch, int fromIndex)
If a character with value ch
occurs in the character
sequence represented by this String
object at an index
no smaller than fromIndex
, then the index of the first
such occurrence is returned--that is, the smallest value k
such that:
is true. If no such character occurs in this string at or after position(this.charAt(k) == ch) && (k >= fromIndex)
fromIndex
, then -1
is returned.
There is no restriction on the value of fromIndex
.
If it is negative, it has the same effect as if it were zero: this
entire string may be searched. If it is greater than the length of
this string, it has the same effect as if it were equal to the length
of this string: -1
is returned.
s
- the string.ch
- a character.fromIndex
- the index to start the search from.fromIndex
, or -1
if the character does not occur.public static java.lang.String listToString(java.util.List list)
list
- list to convert to string.public static java.util.List stringToList(java.lang.String str)
str
- string to convert to list.public static java.lang.String toHexString(int i)
i
- integer to convert.public static java.lang.String[] tokenize(java.lang.String input)
input
- string to be split apart.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |