public class StringUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static @Nullable String |
appendIfMissing(String str,
CharSequence suffix,
CharSequence... suffixes)
Appends the suffix to the end of the string if the string does not already end with any of the suffixes.
|
static @Nullable String |
chop(String str)
Removes the last character from a string.
|
static boolean |
endsWithIgnoreCase(CharSequence str,
CharSequence suffix)
Case-insensitive check if a CharSequence ends with a specified suffix.
|
static @NotNull String |
getStringTail(String val,
int minRuleLength) |
static boolean |
isBlank(CharSequence cs)
Checks if a CharSequence is empty (""), null or whitespace only.
|
static boolean |
isEmpty(CharSequence cs)
Checks if a CharSequence is empty (""), null or not.
|
static boolean |
isNotBlank(CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
|
static String |
normalizeEntityName(String name) |
static String |
prependIfMissing(String str,
String prefix)
Prepends a prefix to a string if it doesn't already start with it.
|
static String |
removeEndIgnoreCase(String str,
String remove)
Removes a substring from the end of a string (case insensitive).
|
static @Nullable String |
unescapeJava(String str)
Unescapes Java string escape sequences in the input string.
|
public static final String EMPTY
public static boolean isEmpty(CharSequence cs)
cs - The CharSequence to check, may be nullpublic static boolean isBlank(CharSequence cs)
Character.isWhitespace(char).cs - the CharSequence to check, may be nullpublic static boolean isNotBlank(CharSequence cs)
Character.isWhitespace(char).cs - the CharSequence to check, may be null@Nullable public static @Nullable String chop(String str)
str - the string to choppublic static String removeEndIgnoreCase(String str, String remove)
str - the string to processremove - the substring to remove from the endpublic static String prependIfMissing(String str, String prefix)
str - the string to processprefix - the prefix to prepend@Nullable public static @Nullable String appendIfMissing(String str, CharSequence suffix, CharSequence... suffixes)
str - the string to processsuffix - the suffix to append to the end of the stringsuffixes - additional suffixes that are valid terminatorspublic static boolean endsWithIgnoreCase(CharSequence str, CharSequence suffix)
str - the CharSequence to check, may be nullsuffix - the suffix to find, may be null@Nullable public static @Nullable String unescapeJava(String str)
str - the string to unescape, may be nullCopyright © 2025. All rights reserved.