public class StringUtil
extends java.lang.Object
| Constructor and Description |
|---|
StringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equals(java.lang.String str1,
java.lang.String str2)
A string equals that allows null values
and treats them as equivalent to empty strings.
|
static boolean |
hasContent(java.lang.String str)
Deprecated.
Use Guava.
|
static java.lang.String |
normalizeUnicode(java.lang.String str)
Normalize a string potentially containing Unicode to NFC form.
|
static boolean |
parseBoolean(java.lang.String bStr,
boolean defaultValue)
Parse a boolean.
|
static double |
parseDouble(java.lang.String doubleStr,
float defaultValue)
Parse a double.
|
static float |
parseFloat(java.lang.String floatStr,
float defaultValue)
Parse a float.
|
static int |
parseInt(java.lang.String intStr,
int defaultValue)
Parse an integer.
|
static long |
parseLong(java.lang.String intStr,
long defaultValue)
Parse a long.
|
static java.lang.String |
randomString(int numChars)
Gets a string of random characters.
|
public static final boolean hasContent(java.lang.String str)
str - The string.public static final java.lang.String randomString(int numChars)
numChars - The maximum number of characters.public static boolean equals(java.lang.String str1,
java.lang.String str2)
str1 - The first string.str2 - The second string.public static final java.lang.String normalizeUnicode(java.lang.String str)
str - The input string.public static final int parseInt(java.lang.String intStr,
int defaultValue)
intStr - The string to parse.defaultValue - The value to return if the input is null, empty, or not an integer.public static final long parseLong(java.lang.String intStr,
long defaultValue)
intStr - The string to parse.defaultValue - The value to return if the input is null, empty, or not an integer.public static final boolean parseBoolean(java.lang.String bStr,
boolean defaultValue)
Case-insensitive. Strings other than 'true' return false.
bStr - The string to parse.defaultValue - The value to return if the input is null, empty, or not a boolean.public static final float parseFloat(java.lang.String floatStr,
float defaultValue)
floatStr - The string to parse.defaultValue - The value to return if the input is null, empty, or not a floating point value.public static final double parseDouble(java.lang.String doubleStr,
float defaultValue)
doubleStr - The string to parse.defaultValue - The value to return if the input is null, empty, or not a floating point value.