public final class StringUtil extends Object
| Constructor and Description |
|---|
StringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
findFirstNotOf(String str,
String chars)
Finds the first character that is NOT in the specified character set.
|
static int |
findFirstOf(String str,
String chars)
Finds the first occurrence of any character from the specified set.
|
static int |
findLastNotOf(String str,
String chars)
Finds the last character that is NOT in the specified character set.
|
static int |
findLastOf(String str,
String chars)
Finds the last occurrence of any character from the specified set.
|
static int |
findOf(String str,
String chars,
int startIdx,
int endIdx,
int offset,
boolean isEqual)
Generic character finding method with customizable search parameters.
|
static boolean |
hasData(String value)
Checks if a string contains valid data (not null and not empty).
|
static int |
toInteger(String value)
Converts a string to an integer value.
|
static long |
toLong(String value)
Converts a string to a long value.
|
static String |
trim(String trimStr,
String trimChars)
Trims specified characters from both ends of a string.
|
public static final int findFirstNotOf(String str, String chars)
str - string to search inchars - characters to exclude from searchpublic static final int findFirstOf(String str, String chars)
str - string to search inchars - characters to search forpublic static final int findLastNotOf(String str, String chars)
str - string to search inchars - characters to exclude from searchpublic static final int findLastOf(String str, String chars)
str - string to search inchars - characters to search forpublic static final int findOf(String str, String chars, int startIdx, int endIdx, int offset, boolean isEqual)
str - the string to search inchars - the characters to search forstartIdx - the starting indexendIdx - the ending indexoffset - the search direction (1 for forward, -1 for backward)isEqual - true to find matching characters, false to find non-matchingpublic static final boolean hasData(String value)
value - the string to checkpublic static final int toInteger(String value)
value - the string to convertpublic static final long toLong(String value)
value - the string to convert