|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.shared_tomahawk.util.StringUtils
public final class StringUtils
Implements utility functions for the String class
Emphasis on performance and reduced memory allocation/garbage collection in exchange for longer more complex code.
Method Summary | |
---|---|
static java.lang.String |
dequote(java.lang.String str,
char quote)
Undoubles the quotes inside the string Example: |
static java.lang.String |
dequote(java.lang.String str,
int begin,
int end,
char quote)
Undoubles the quotes inside a substring Example: |
static java.lang.String |
dequoteFull(java.lang.String str,
char quote)
Removes the surrounding quote and any double quote inside the string Example: |
static java.lang.String |
dequoteFull(java.lang.String str,
int begin,
int end,
char quote)
|
static boolean |
isFloatNoExponent(java.lang.String str)
Checks that the string represents a floating point number that CANNOT be in exponential notation |
static boolean |
isFloatWithOptionalExponent(java.lang.String str)
|
static boolean |
isInteger(java.lang.String str)
|
static boolean |
isUnsignedInteger(java.lang.String str)
|
static int |
minIndex(int a,
int b)
Returns the minimum index >= 0, if any |
static java.lang.StringBuffer |
replace(java.lang.StringBuffer out,
java.lang.String s,
java.lang.String repl,
java.lang.String with)
|
static java.lang.String |
replace(java.lang.String str,
char repl,
java.lang.String with)
|
static java.lang.String |
replace(java.lang.String str,
java.lang.String repl,
java.lang.String with)
|
static java.lang.String[] |
splitLongString(java.lang.String str,
char separator)
Split a string into an array of strings arround a character separator. |
static java.lang.String[] |
splitLongString(java.lang.String str,
char separator,
char quote)
Split a string into an array of strings arround a character separator. |
static java.lang.String[] |
splitShortString(java.lang.String str,
char separator)
Split a string into an array of strings arround a character separator. |
static java.lang.String[] |
splitShortString(java.lang.String str,
char separator,
char quote)
Split a string into an array of strings arround a character separator. |
static java.lang.String |
substring(java.lang.String str,
int begin,
int end)
|
static java.lang.String[] |
trim(java.lang.String[] strings)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean isFloatNoExponent(java.lang.String str)
str
- the string to check
public static boolean isFloatWithOptionalExponent(java.lang.String str)
public static boolean isInteger(java.lang.String str)
public static boolean isUnsignedInteger(java.lang.String str)
public static java.lang.String dequote(java.lang.String str, char quote)
hello""world becomes hello"world
str
- input string to dequotequote
- the quoting char
public static java.lang.String dequote(java.lang.String str, int begin, int end, char quote)
hello""world becomes hello"worldWARNING: scan for quote may continue to the end of the string, make sure that either
charAt(end + 1) == quote
or end =
str.lentgth()
. If in doubt call
dequote(str.substring(begin, end), quote)
str
- input string from which to get the substring, must not be
nullbegin
- begin index for substringend
- end index for substringquote
- the quoting char
java.lang.IllegalArgumentException
- if string is incorrectly quotedpublic static java.lang.String dequoteFull(java.lang.String str, char quote)
"hello""world" becomes hello"world
str
- input string to dequotequote
- the quoting char
public static java.lang.String dequoteFull(java.lang.String str, int begin, int end, char quote)
public static java.lang.String replace(java.lang.String str, java.lang.String repl, java.lang.String with)
public static java.lang.String replace(java.lang.String str, char repl, java.lang.String with)
public static java.lang.StringBuffer replace(java.lang.StringBuffer out, java.lang.String s, java.lang.String repl, java.lang.String with)
public static java.lang.String[] splitLongString(java.lang.String str, char separator)
str
- the string to be splitseparator
- the separator character
public static java.lang.String[] splitLongString(java.lang.String str, char separator, char quote)
str
- the string to be splitseparator
- the separator characterquote
- the quote character
java.lang.IllegalArgumentException
- DOCUMENT ME!public static java.lang.String[] splitShortString(java.lang.String str, char separator)
str
- the string to be splitseparator
- the separator character
public static java.lang.String[] splitShortString(java.lang.String str, char separator, char quote)
str
- the string to be splitseparator
- the separator characterquote
- the quote character
java.lang.IllegalArgumentException
- DOCUMENT ME!public static java.lang.String substring(java.lang.String str, int begin, int end)
public static java.lang.String[] trim(java.lang.String[] strings)
public static int minIndex(int a, int b)
Use to find the first of two characters in a string:
minIndex(s.indexOf('/'), indexOf('\'))
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |