public final class Strings extends Object
Modifier and Type | Field and Description |
---|---|
static String |
EMPTY |
static String |
LINE_SEPARATOR |
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(Iterable<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 |
surround(String target,
char begin,
char end)
Gives a string consisting of a given string prepended and appended with surrounding characters.
|
public static final String EMPTY
public static final String LINE_SEPARATOR
public static String repeat(char ch, int count)
ch
- the character to repeatcount
- how many times to repeat the characterpublic static boolean isNullOrEmpty(String target)
target
- string to checktrue
if the target string is null or emptypublic static String surround(String target, char begin, char end)
target
- a stringbegin
- character to prependend
- character to appendpublic static String join(String[] pieces, String separator)
pieces
- the strings to joinseparator
- the separatorpublic static String join(Iterable<String> pieces, String separator)
pieces
- the elements whose string representations are to be joinedseparator
- the separatorCopyright © 2016. All Rights Reserved.