|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.flyway.core.util.StringUtils
public class StringUtils
Various string-related utilities.
| Method Summary | |
|---|---|
static boolean |
isNumeric(java.lang.String str)
Checks if the String contains only unicode digits. |
static java.lang.String[] |
split(java.lang.String str,
java.lang.String separatorChars)
Splits the provided text into an array, separators specified. |
static java.lang.String |
trimOrPad(java.lang.String str,
int length)
Trims or pads (with spaces) this string, so it has this exact length. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String trimOrPad(java.lang.String str,
int length)
str - The string to adjust. null is treated as an empty string.length - The exact length to reach.
public static boolean isNumeric(java.lang.String str)
Checks if the String contains only unicode digits. A decimal point is not a unicode digit and returns false.
null will return false.
An empty String ("") will return true.
StringUtils.isNumeric(null) = false
StringUtils.isNumeric("") = true
StringUtils.isNumeric(" ") = false
StringUtils.isNumeric("123") = true
StringUtils.isNumeric("12 3") = false
StringUtils.isNumeric("ab2c") = false
StringUtils.isNumeric("12-3") = false
StringUtils.isNumeric("12.3") = false
str - the String to check, may be null
true if only contains digits, and is non-null
public static java.lang.String[] split(java.lang.String str,
java.lang.String separatorChars)
Splits the provided text into an array, separators specified. This is an alternative to using StringTokenizer.
The separator is not included in the returned String array. Adjacent separators are treated as one separator. For more control over the split use the StrTokenizer class.
A null input String returns null.
A null separatorChars splits on whitespace.
StringUtils.split(null, *) = null
StringUtils.split("", *) = []
StringUtils.split("abc def", null) = ["abc", "def"]
StringUtils.split("abc def", " ") = ["abc", "def"]
StringUtils.split("abc def", " ") = ["abc", "def"]
StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"]
str - the String to parse, may be nullseparatorChars - the characters used as the delimiters,
null splits on whitespace
null if null String input
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||