Modifier and Type | Method and Description |
---|---|
static boolean |
isNullOrEmpty(String target)
Tells whether the given string is either
or consists solely of
whitespace characters. |
static String |
join(List<String> pieces,
String separator)
Gives a string consisting of the string representations of the elements of a
given array of objects, each separated by a given separator string.
|
static String |
join(String[] pieces,
String separator)
Gives a string consisting of the elements of a given array of strings, each
separated by a given separator string.
|
static String |
repeat(char ch,
int count)
Gives a string consisting of the given character repeated the given number of
times.
|
static String |
replace(String text,
String searchString,
String replacement)
Replaces all occurrences of a String within another String.
|
static String |
replace(String text,
String searchString,
String replacement,
int max)
Replaces a String with another String inside a larger String,
for the first
max values of the search String. |
static String |
replaceOnce(String text,
String searchString,
String replacement)
Replaces a String with another String inside a larger String, once.
|
public static final String EMPTY
public static String repeat(char ch, int count)
Gives a string consisting of the given character repeated the given number of times.
ch
- the character to repeatcount
- how many times to repeat the characterpublic static boolean isNullOrEmpty(String target)
Tells whether the given string is either or consists solely of
whitespace characters.
target
- string to checktrue
if the target string is null or emptypublic static String join(String[] pieces, String separator)
pieces
- the strings to joinseparator
- the separatorpublic static String join(List<String> pieces, String separator)
pieces
- the elements whose string representations are to be joinedseparator
- the separatorpublic static String replaceOnce(String text, String searchString, String replacement)
Replaces a String with another String inside a larger String, once.
A null
reference passed to this method is a no-op.
StringUtils.replaceOnce(null, *, *) = null StringUtils.replaceOnce("", *, *) = "" StringUtils.replaceOnce("any", null, *) = "any" StringUtils.replaceOnce("any", *, null) = "any" StringUtils.replaceOnce("any", "", *) = "any" StringUtils.replaceOnce("aba", "a", null) = "aba" StringUtils.replaceOnce("aba", "a", "") = "ba" StringUtils.replaceOnce("aba", "a", "z") = "zba"
text
- text to search and replace in, may be nullsearchString
- the String to search for, may be nullreplacement
- the String to replace with, may be nullnull
if null String inputreplace(String text, String searchString, String replacement, int max)
public static String replace(String text, String searchString, String replacement)
Replaces all occurrences of a String within another String.
A null
reference passed to this method is a no-op.
StringUtils.replace(null, *, *) = null StringUtils.replace("", *, *) = "" StringUtils.replace("any", null, *) = "any" StringUtils.replace("any", *, null) = "any" StringUtils.replace("any", "", *) = "any" StringUtils.replace("aba", "a", null) = "aba" StringUtils.replace("aba", "a", "") = "b" StringUtils.replace("aba", "a", "z") = "zbz"
text
- text to search and replace in, may be nullsearchString
- the String to search for, may be nullreplacement
- the String to replace it with, may be nullnull
if null String inputreplace(String text, String searchString, String replacement, int max)
public static String replace(String text, String searchString, String replacement, int max)
Replaces a String with another String inside a larger String,
for the first max
values of the search String.
A null
reference passed to this method is a no-op.
StringUtils.replace(null, *, *, *) = null StringUtils.replace("", *, *, *) = "" StringUtils.replace("any", null, *, *) = "any" StringUtils.replace("any", *, null, *) = "any" StringUtils.replace("any", "", *, *) = "any" StringUtils.replace("any", *, *, 0) = "any" StringUtils.replace("abaa", "a", null, -1) = "abaa" StringUtils.replace("abaa", "a", "", -1) = "b" StringUtils.replace("abaa", "a", "z", 0) = "abaa" StringUtils.replace("abaa", "a", "z", 1) = "zbaa" StringUtils.replace("abaa", "a", "z", 2) = "zbza" StringUtils.replace("abaa", "a", "z", -1) = "zbzz"
text
- text to search and replace in, may be nullsearchString
- the String to search for, may be nullreplacement
- the String to replace it with, may be nullmax
- maximum number of values to replace, or -1
if no maximumnull
if null String inputelasticsearch-river-jdbc