public class StringUtil extends Object
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
collapsePathDots(String path)
Changes a path containing '..', '.' and empty dirs into a path that
doesn't.
|
static String |
defaultIfNull(String text)
If the given text is null return "", the original text otherwise.
|
static String |
defaultIfNull(String text,
String defaultValue)
If the given text is null return "", the given defaultValue otherwise.
|
static boolean |
endsWithIgnoreCase(String source,
String suffix)
Whether the given source string ends with the given suffix, ignoring
case.
|
static boolean |
equals(String text1,
String text2)
Null-safe string comparator
|
static int |
hashCode(String... values) |
static boolean |
isBlank(String text)
Whether the String is null, zero-length and does contain only whitespace.
|
static boolean |
isEmpty(String text)
Whether the given string is null or zero-length.
|
static boolean |
isNotBlank(String text)
Whether the String is not null, not zero-length and does not contain of
only whitespace.
|
static String |
substringAfter(String text,
char c)
Gives the substring of the given text after the given separator.
|
static String |
substringAfterLast(String text,
char separator)
Gives the substring of the given text after the last occurrence of the
given separator.
|
static String |
substringBefore(String text,
char separator)
Gives the substring of the given text before the given separator.
|
static String |
substringBeforeLast(String text,
char separator)
Gives the substring of the given text before the last occurrence of the
given separator.
|
static String |
toString(Object... keyValues)
Pretty toString printer.
|
public static String collapsePathDots(String path)
path
- public static boolean isNotBlank(String text)
text
- public static boolean isBlank(String text)
public static boolean isEmpty(String text)
text
- the input for this methodpublic static boolean endsWithIgnoreCase(String source, String suffix)
source
- suffix
- public static String defaultIfNull(String text)
text
- public static String defaultIfNull(String text, String defaultValue)
text
- defaultValue
- public static boolean equals(String text1, String text2)
text1
- text2
- public static String toString(Object... keyValues)
keyValues
- public static int hashCode(String... values)
public static String substringBefore(String text, char separator)
text
- separator
- public static String substringBeforeLast(String text, char separator)
text
- separator
- public static String substringAfterLast(String text, char separator)
text
- separator
- public static String substringAfter(String text, char c)
text
- the input textc
- the separator charCopyright © 2009–2017. All rights reserved.