public class OkkamStrings extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> StringBuilder |
appendAll(StringBuilder sb,
T... elements)
Append to the string Builder all elements.
|
static boolean |
isEmptyAndNotNull(String string,
boolean trim)
Check if the string is empty and not null.
|
static boolean |
isEmptyOrNull(String string,
boolean trim)
Check if the string is null or empty.
|
static boolean |
isOneOf(String string,
boolean trim,
String... ors)
Check if the string is one of the specified values.
|
static boolean |
noOneIsEmptyOrNull(boolean trim,
String... strings)
Check if the strings are not empty and not blank.
|
static <T> String |
separateArrayBy(T[] array,
String separator)
Generate a string based on array, with a specified separator.
|
static <T> String |
separateTreeMapValuesBy(Map<T,String> map,
String separator)
Generate a string based on map values, with a specified separator.
|
static String |
trimIfNecessary(boolean trim,
String src)
Returns the trimmed string when not null and necessary (i.e.
|
public static boolean isEmptyOrNull(String string, boolean trim)
string - The input stringtrim - true to trim the input string (when not null)public static boolean isEmptyAndNotNull(String string, boolean trim)
string - The input stringtrim - true to trim the input string (when not null)public static boolean noOneIsEmptyOrNull(boolean trim,
String... strings)
trim - true to trim the strings (when not empty)strings - The input stringspublic static boolean isOneOf(String string, boolean trim, String... ors)
string - The input stringtrim - true to trim the strings to check for equalityors - The values to checkpublic static String trimIfNecessary(boolean trim, String src)
trim - true to trim the passed stringsrc - the string to trim (maybe)@SafeVarargs public static <T> StringBuilder appendAll(StringBuilder sb, T... elements)
T - The elements typesb - The string builderelements - The elements to appendpublic static <T> String separateArrayBy(T[] array, String separator)
T - The array typearray - The input arrayseparator - The separatorpublic static <T> String separateTreeMapValuesBy(Map<T,String> map, String separator)
T - The map key typemap - The input mapseparator - The separatorCopyright © 2018 Okkam srl. All rights reserved.