Package ai.expert.nlapi.utils
Class StringUtils
- java.lang.Object
-
- ai.expert.nlapi.utils.StringUtils
-
public class StringUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description StringUtils()should not be used
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanequals(java.lang.String str1, java.lang.String str2)Compares two Stringsstatic booleanisBlank(java.lang.String s)Checks if a String is empty (""), null or whitespace only.static booleanisEmpty(java.lang.String s)Checks if a String is empty ("") or null.static booleanisNotBlank(java.lang.String s)Checks if a String is not empty (""), not null and not whitespace only.static java.lang.Stringtrim(java.lang.String str)Trim String, if null returns nullstatic java.lang.StringtrimToEmpty(java.lang.String str)Trim String, if null or empty returns emptystatic java.lang.StringtrimToNull(java.lang.String str)Trim String, if null or empty returns null
-
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(java.lang.String s)
Checks if a String is empty ("") or null.- Parameters:
s- the String to check, may be null- Returns:
- true if the String is empty or null
-
isBlank
public static boolean isBlank(java.lang.String s)
Checks if a String is empty (""), null or whitespace only.- Parameters:
s- the String to check, may be null- Returns:
- true if the String is null, empty or whitespace only
-
isNotBlank
public static boolean isNotBlank(java.lang.String s)
Checks if a String is not empty (""), not null and not whitespace only.- Parameters:
s- the String to check, may be null- Returns:
- true if the CharSequence is not empty and not null and not whitespace only
-
trim
public static java.lang.String trim(java.lang.String str)
Trim String, if null returns null- Parameters:
str- the String to be trimmed- Returns:
- the trimmed string
-
trimToNull
public static java.lang.String trimToNull(java.lang.String str)
Trim String, if null or empty returns null- Parameters:
str- the String to be trimmed- Returns:
- the trimmed String
-
trimToEmpty
public static java.lang.String trimToEmpty(java.lang.String str)
Trim String, if null or empty returns empty- Parameters:
str- the String to be trimmed- Returns:
- the trimmed String
-
equals
public static boolean equals(java.lang.String str1, java.lang.String str2)Compares two Strings- Parameters:
str1- the first Stringstr2- the second String- Returns:
trueif the Strings are equal, case-sensitive
-
-