public class StringUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
capitalize(java.lang.String s)
Capitalizes the very first character of a given string.
|
static java.lang.String |
emptyAsNull(java.lang.String s)
Returns null when s is the empty string, or s as is otherwise.
|
static boolean |
isBlank(java.lang.String s)
Returns true iff s is either null or the empty string.
|
static <T> java.lang.String |
join(java.lang.Iterable<T> coll,
java.lang.String separator)
Joins into a string an iterable collection of objects by using a
separator.
|
static java.lang.String |
join(java.lang.Object[] arr,
java.lang.String separator)
Joins into a string an array of objects by using a separator.
|
static java.lang.String |
nullAsEmpty(java.lang.String s)
Returns the empty string when s is null, or s as is otherwise.
|
static java.lang.String |
replicate(int n,
char c)
Generates a string composed of just n consecutive occurrences of char c.
|
static java.lang.String |
replicate(int n,
java.lang.String s)
Generates a string composed of n consecutive occurrences of the string s.
|
public static java.lang.String replicate(int n, char c)
n
- the number of repetitions of c
c
- the character to be replicatedpublic static java.lang.String replicate(int n, java.lang.String s)
n
- the number of repetitions of s
s
- the string to be repeatedpublic static boolean isBlank(java.lang.String s)
s
- the string to be testedpublic static java.lang.String nullAsEmpty(java.lang.String s)
public static java.lang.String emptyAsNull(java.lang.String s)
public static java.lang.String join(java.lang.Object[] arr, java.lang.String separator)
arr
- the array of elements to be converted in strings and joined
togetherseparator
- the separator to put in between any two adjacent stringspublic static <T> java.lang.String join(java.lang.Iterable<T> coll, java.lang.String separator)
coll
- the collection of elements to be converted in strings and
joined togetherseparator
- the separator to put in between any two adjacent strings*public static java.lang.String capitalize(java.lang.String s)
s
- the string to be capitalized