public final class Strings
extends java.lang.Object
String related functions.| Modifier and Type | Method and Description |
|---|---|
static boolean |
isEmpty(java.lang.String s)
Check whether a
String is empty. |
static <T> java.lang.String |
join(java.lang.Iterable<T> objects,
java.util.function.Function<T,java.lang.String> converter,
java.lang.String delimiter,
int limit)
Join a collection of strings.
|
static <T> java.lang.String |
join(java.lang.Iterable<T> objects,
java.lang.String delimiter)
Join a collection of strings.
|
static <T> java.lang.String |
join(java.lang.Iterable<T> objects,
java.lang.String delimiter,
int limit)
Join a collection of strings.
|
static boolean |
notEmpty(java.lang.String s)
Check whether a
String is not empty. |
static java.lang.String |
safe(java.lang.String s)
Make sure a
String is not null. |
static java.lang.String |
safeTrim(java.lang.String s)
Make sure a
String is trimmed. |
static java.lang.String[] |
split(java.lang.String s,
java.lang.String delimiter)
Split a
String into multiple sub strings. |
public static boolean isEmpty(@Nullable java.lang.String s)
String is empty.
A String is considered empty if it is either null of of length 0.
s - The string to check.true if the string is empty.public static boolean notEmpty(@Nullable java.lang.String s)
String is not empty.
A String is considered empty if it is either null of of length 0.
s - The string to check.true if the string is not empty.public static java.lang.String safe(@Nullable java.lang.String s)
String is not null.
The empty string is returned if a null value is submitted.
s - The string to check.null was submitted.@Nullable public static java.lang.String safeTrim(@Nullable java.lang.String s)
String is trimmed.
If the string is null this function simply returns the submitted value.
s - The string to trim.null if null was submitted.public static java.lang.String[] split(java.lang.String s,
java.lang.String delimiter)
String into multiple sub strings.s - The string to split.delimiter - The single character string to use as a delimiter.public static <T> java.lang.String join(java.lang.Iterable<T> objects,
java.lang.String delimiter)
T - The object type to join.objects - The objects to join.delimiter - The delimiter to use.public static <T> java.lang.String join(java.lang.Iterable<T> objects,
java.lang.String delimiter,
int limit)
T - The object type to join.objects - The objects to join.delimiter - The delimiter to use.limit - The length after which the output will be truncated.public static <T> java.lang.String join(java.lang.Iterable<T> objects,
java.util.function.Function<T,java.lang.String> converter,
java.lang.String delimiter,
int limit)
T - The object type to join.objects - The objects to join.converter - The converter to use for object to string conversion.delimiter - The delimiter to use.limit - The length after which the output will be truncated.