public class StringUtils extends Object
Modifier and Type | Field and Description |
---|---|
static NumberFormat |
DOUBLE_FORMAT |
static NumberFormat |
INTEGER_FORMAT |
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
concatWithOperator(String leftPart,
String rightPart,
String operator)
Concatenates two expressions with an operator if both are not empty.
|
static String |
concatWithOperator(String leftPart,
String rightPart,
String operator,
String leftBracket,
String rightBracket)
Concatenates two expressions with an operator if both are not empty.
|
static String |
convertCamelCase(String text,
String separator)
Converts a camel case keyword to a string with the specified separator where all characters are in lower case.
Example: anExampleKeyword would be converted to an-example-keyword and A
to a . |
static String |
firstCharToLowerCase(String text) |
static String |
firstCharToUpperCase(String text) |
static String |
invert(CharSequence s) |
static void |
renameRepeatedEntries(List<String> list) |
static void |
renameRepeatedEntries(String[] array) |
static String |
repeat(CharSequence element,
int count) |
public static final NumberFormat DOUBLE_FORMAT
public static final NumberFormat INTEGER_FORMAT
public StringUtils()
public static String invert(CharSequence s)
public static String repeat(CharSequence element, int count)
public static void renameRepeatedEntries(String[] array)
public static void renameRepeatedEntries(List<String> list)
public static String concatWithOperator(String leftPart, String rightPart, String operator, String leftBracket, String rightBracket)
Concatenates two expressions with an operator if both are not empty.
Example:
concatWithOperator("A", "B", " + ", "(", ")")
would return
"(A + B)".
concatWithOperator("A", "", " + ", "(", ")")
would return
"A".
leftPart
- the left expressionrightPart
- the right expressionoperator
- the operator (including white spaces if necessary)leftBracket
- the left bracket to be used (e.g. "{")rightBracket
- the right bracket to be used (e.g. "}")public static String concatWithOperator(String leftPart, String rightPart, String operator)
leftPart
- the left expressionrightPart
- the right expressionoperator
- the operator (including white spaces if necessary)concatWithOperator(String, String, String, String, String)
public static String firstCharToLowerCase(String text)
public static String firstCharToUpperCase(String text)
public static String convertCamelCase(String text, String separator)
anExampleKeyword
would be converted to an-example-keyword
and A
to a
.text
- the string to be convertedseparator
- the separator to be inserted