public class StringUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isBlank(String s)
Returns true if the string is null or it does not contain any non space characters.
|
static boolean |
isEmpty(String str)
Checks if a String is empty ("") or null.
|
static String |
joinStrings(List<String> list,
String delim)
This method takes a List<String> and a delimiter and joins the
strings into a single string, where the original strings are separated
using the given delimiter.
|
static List<String> |
split(String value,
String separator)
This method returns an immutable List<String>, but different from String's split()
it trims the results in the input String, and removes any empty string from
the resulting List.
|
public static List<String> split(String value, String separator)
public static String joinStrings(List<String> list, String delim)
String.join(CharSequence, Iterable)
Note that if an individual element is null, then "null" is added.
list - a List that will have its elements joined togetherdelim - a sequence of characters that is used to separate each of the
elements in the resulting Stringnull if list is nullNullPointerException - if delim is nullpublic static boolean isBlank(String s)
s - the stringpublic static boolean isEmpty(String str)
Checks if a String is empty ("") or null.
StringUtils.isEmpty(null) = true
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false
StringUtils.isEmpty("bob") = false
StringUtils.isEmpty(" bob ") = false
str - the String to check, may be nulltrue if the String is empty or nullCopyright © 2008–2022 The Apache Software Foundation. All rights reserved.