public class StringUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY_STRING |
| Constructor and Description |
|---|
StringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
emptyToNull(String string)
Returns the given string if it is nonempty;
null otherwise. |
static boolean |
isNullOrEmpty(String str) |
static <T> String |
join(String... elements)
Joins the elements of the provided array into a single String containing the provided list of elements.
|
static String |
join(String[] array,
String separator) |
static <T> String |
joinUsingDelim(String delim,
String... elements) |
static String |
nullToEmpty(String string)
Returns the given string if it is non-null; the empty string otherwise.
|
static String |
objToString(Object obj) |
static String |
toHexString(byte[] bytes) |
public static final String EMPTY_STRING
public static <T> String join(String... elements)
Joins the elements of the provided array into a single String containing the provided list of elements.
No separator is added to the joined String. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null) = null StringUtils.join([]) = "" StringUtils.join([null]) = "" StringUtils.join(["a", "b", "c"]) = "abc" StringUtils.join([null, "", "a"]) = "a"
public static String toHexString(byte[] bytes)
public static boolean isNullOrEmpty(String str)
public static String nullToEmpty(@Nullable String string)
string - the string to test and possibly returnstring itself if it is non-null; "" if it is nullCopyright © 2021 The Apache Software Foundation. All rights reserved.