| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY
The empty String
"". |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equals(String cs1,
String cs2)
Compares two Strings, returning
true if they represent
equal sequences of characters. |
static String |
fromBytes(byte[] bytes,
Charset charset)
Encode the given bytes as a string using the given charset
|
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 ("") or null.
|
static boolean |
isEmpty(Object object)
Checks if a object is empty or null.
|
static String |
join(String delimiter,
Iterable<? extends String> elements)
Join any Strings.
|
static String |
lowerCase(String str)
Converts a String to lower case as per
String.toLowerCase(). |
static boolean |
safeStringToBoolean(String value)
Convert a string to boolean safely (as opposed to the less strict
Boolean.parseBoolean(String)). |
static boolean |
startsWithIgnoreCase(String str,
String prefix)
Tests if this string starts with the specified prefix ignoring case considerations.
|
static String |
substring(String str,
int start,
int end)
Gets a substring from the specified String avoiding exceptions.
|
static String |
toAliString(String className,
Map<String,Object> fieldMap)
Create a to-string result for the given class name and field map.
|
static byte[] |
toBytes(String str) |
static String |
toString(byte[] bytes)
Convert a bytes to string(utf8)
|
static String |
trim(String str)
The String is trimmed using
String.trim(). |
static String |
upperCase(String str)
Converts a String to upper case as per
String.toUpperCase(). |
public static final String EMPTY
"".public static boolean isEmpty(CharSequence cs)
cs - the CharSequence to check, may be nulltrue if the CharSequence is empty or nullpublic static boolean isEmpty(Object object)
object - the String.valueOf(object) to check, may be nulltrue if the String.valueOf(object) is empty or nullpublic static boolean isBlank(CharSequence cs)
Whitespace is defined by Character.isWhitespace(char).
cs - the CharSequence to check, may be nulltrue if the CharSequence is null, empty or whitespace onlypublic static String trim(String str)
String.trim().
Trim removes start and end characters <= 32.str - the String to be trimmed, may be nullnull if null String inputpublic static boolean equals(String cs1, String cs2)
true if they represent
equal sequences of characters.cs1 - the first String, may be nullcs2 - the second String, may be nulltrue if the Strings are equal (case-sensitive), or both nullObject.equals(Object)public static String join(String delimiter, Iterable<? extends String> elements)
delimiter - the delimiter which split two Strings, should not be nullelements - the Strings Iterable, should not be nullStringpublic static String substring(String str, int start, int end)
str - the String to get the substring from, may be nullstart - the position to start from, negative means count back from the end of the String by this many charactersend - the position to end at (exclusive), negative means count back from the end of the String by this many
charactersnull if null String inputpublic static String upperCase(String str)
String.toUpperCase().
This uses "ENGLISH" as the locale.
str - the String to upper case, may be nullnull if null String inputpublic static String lowerCase(String str)
String.toLowerCase().
This uses "ENGLISH" as the locale.
str - the String to lower case, may be nullnull if null String inputpublic static String fromBytes(byte[] bytes, Charset charset) throws UncheckedIOException
UncheckedIOException - with a CharacterCodingException as the cause if the bytes cannot be encoded using the
provided charset.public static boolean startsWithIgnoreCase(String str, String prefix)
str - the string to be testedprefix - the prefixpublic static boolean safeStringToBoolean(String value)
Boolean.parseBoolean(String)). If a customer
specifies a boolean value it should be "true" or "false" (case insensitive) or an exception will be thrown.public static String toAliString(String className, Map<String,Object> fieldMap)
className - The name of the class being toString.fieldMap - The key and value of the field. Value is ignored if null.public static byte[] toBytes(String str)
public static String toString(byte[] bytes)
Copyright © 2022. All rights reserved.