|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xnap.util.StringHelper
public class StringHelper
Provides a set of static methods that help with string parsing and modifying.
Field Summary | |
---|---|
static java.lang.String |
ALPHA_NUM
|
static java.lang.String |
ALPHABET_LOWER
|
static java.lang.String |
ALPHABET_UPPER
|
static java.lang.String |
ANYTHING
|
static java.lang.String |
EMAIL
|
static java.lang.String |
HOST
|
static java.lang.String |
MONEY_USD
|
static java.lang.String |
NUMBERS_DECIMAL
|
static java.lang.String |
NUMBERS_INT
|
static java.lang.String |
REGULAR_STRING
|
Constructor Summary | |
---|---|
StringHelper()
|
Method Summary | |
---|---|
static java.lang.String |
firstToken(java.lang.String text,
java.lang.String separator)
Splits text at the first occurence of separator
and returns the left part, excluding the separator. |
static int |
indexOfDigit(java.lang.String s)
Returns the index of the first digit in s . |
static java.lang.String |
lastPrefix(java.lang.String text,
java.lang.String separator)
Splits text at the last occurence of separator
and returns the left part, excluding the separator. |
static java.lang.String |
lastToken(java.lang.String text,
java.lang.String separator)
Splits text at the last occurence of separator
and returns the right part, excluding the separator. |
static java.lang.String |
randomString(int length)
Returns a random lower case letter-only string with length
characters. |
static java.lang.String |
replaceAll(java.lang.String s,
java.lang.String oldChars,
java.lang.String newChars)
Replaces all occurences of oldChars in s by
newChars . |
static java.lang.String |
stripExtra(java.lang.String s)
Removes all characters from s that are not letters. |
static java.lang.String[] |
toArray(java.lang.String value,
java.lang.String separators)
|
static java.lang.String |
toFirstUpper(java.lang.String value)
Returns a new String that has the first letter of value
set to upper case. |
static int[] |
toIntArray(java.lang.String value,
java.lang.String separators)
|
static java.util.LinkedList |
toList(java.lang.String value,
java.lang.String separators)
|
static java.lang.String |
toString(byte[] data)
Tries to autodect encoding. |
static java.lang.String |
toString(java.util.Collection c,
java.lang.String separator)
|
static java.lang.String |
toString(int[] array,
java.lang.String separator)
|
static java.lang.String |
toString(java.lang.String[] array,
java.lang.String separator)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ALPHABET_LOWER
public static final java.lang.String ALPHABET_UPPER
public static final java.lang.String NUMBERS_INT
public static final java.lang.String NUMBERS_DECIMAL
public static final java.lang.String MONEY_USD
public static final java.lang.String ALPHA_NUM
public static final java.lang.String EMAIL
public static final java.lang.String HOST
public static final java.lang.String REGULAR_STRING
public static final java.lang.String ANYTHING
Constructor Detail |
---|
public StringHelper()
Method Detail |
---|
public static java.lang.String replaceAll(java.lang.String s, java.lang.String oldChars, java.lang.String newChars)
oldChars
in s
by
newChars
.
s
public static java.lang.String randomString(int length)
length
characters.
public static java.lang.String toFirstUpper(java.lang.String value)
String
that has the first letter of value
set to upper case.
public static java.lang.String stripExtra(java.lang.String s)
s
that are not letters.
Returns a new String which can be for instance used as search text.
public static int indexOfDigit(java.lang.String s)
s
.
s
does not contain digits; the index of
the first digit, otherwiseString.indexOf(String)
public static java.lang.String firstToken(java.lang.String text, java.lang.String separator)
text
at the first occurence of separator
and returns the left part, excluding the separator.
text
- the haystackseparator
- the needle
public static java.lang.String lastToken(java.lang.String text, java.lang.String separator)
text
at the last occurence of separator
and returns the right part, excluding the separator.
text
- the haystackseparator
- the needle
public static java.lang.String lastPrefix(java.lang.String text, java.lang.String separator)
text
at the last occurence of separator
and returns the left part, excluding the separator.
text
- the haystackseparator
- the needle
public static java.lang.String[] toArray(java.lang.String value, java.lang.String separators)
public static int[] toIntArray(java.lang.String value, java.lang.String separators)
public static java.util.LinkedList toList(java.lang.String value, java.lang.String separators)
public static java.lang.String toString(byte[] data)
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |