public final class StringUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CLOSE_PARENTHESES |
static String |
COMMA |
static String |
DOT |
static String |
EMPTY |
static String |
NEW_LINE |
static String |
NULL_COL |
static String |
OPEN_PARENTHESES |
static String |
SINGLE_QUOTE |
static String |
SLASH |
static String |
SPACE |
static org.apache.commons.lang3.builder.StandardToStringStyle |
STYLE |
static String |
WILDCARD |
Modifier and Type | Method and Description |
---|---|
static boolean |
allEquals(String value,
String... strings)
Return true if all strings are the same.
|
static boolean |
anyEmpty(String... strings) |
static String |
asList(String[] values,
String separator) |
static String |
boxify(char boxing,
String text)
Returns a String which is surrounded by a box made of boxing char.
|
static int |
compareTo(String s1,
String s2)
Handle null.
|
static String |
concat(Object... osToString)
Concatenate the string value of the objects (toString()).
|
static String |
concatWithSpaces(Object... osToString)
Concatenate the string value of the objects (toString()) and
insert a space between each value.
|
static String |
defaultFileFormatTimestamp(Date date) |
static String |
defaultFormatDatetime(Date date) |
static String |
emptyIfNull(Object obj)
Deprecated.
use toStringOrEmpty
|
static boolean |
equalsAnyIgnoreCase(String val,
String... strings) |
static boolean |
equalsAnyIgnoreCase(String val,
String toCheck) |
static boolean |
equalsIgnoreCaseOrValueIsWildcard(String value,
String toCheck)
Does equalsIgnoreCase call but if the value is '*', immediately returns true.
|
static String |
firstCharToUpper(String txt) |
static boolean |
ifNotBlank(String text,
Consumer<String> consumer)
If the string is not blank call the consumer (depends on JDK8+)
|
static boolean |
isNotBlank(Object text) |
static boolean |
isWildcardOrNull(String txt) |
static boolean |
noneBlank(String... text) |
static String |
nullIfEmpty(String txt)
return null if txt is null or empty
|
static String |
prepareForNumericParsing(String inputStr)
Remove " and spaces from the input string.
|
static String |
processCaseTreatment(String str,
CaseTreatment caseTreatment) |
static String |
removeTrailingChar(String original,
char charToRemove) |
static String |
replace(String originalPattern,
String newPattern,
String originalString) |
static String |
replaceCRToken(String original)
Replaces any %CR% tokens with the newline character.
|
static String |
replaceToken(String original,
String token,
Object replacement) |
static String |
replaceToken(String original,
String token,
String replacement)
Replaces the token, surrounded by % within a string with new value.
|
static String |
returnIfNotNull(String txt,
String defaultTxt) |
static String |
singleQuote(String text)
Add single quotes ' around the text.
|
static String |
toLowerCase(String str) |
static String |
toString(Object object) |
static String |
toStringOrEmpty(Object object) |
static String |
toUpperCase(String str) |
static String |
trim(String str)
Handles null.
|
static String |
trimAndUpperCase(String str) |
static String |
wrapText(String inString,
String newline,
int wrapColumn)
Takes a block of text which might have long lines in it and wraps
the long lines based on the supplied wrapColumn parameter.
|
public static final String NEW_LINE
public static final String SINGLE_QUOTE
public static final String SLASH
public static final String NULL_COL
public static final String COMMA
public static final String DOT
public static final String SPACE
public static final String EMPTY
public static final String WILDCARD
public static final org.apache.commons.lang3.builder.StandardToStringStyle STYLE
public static final String OPEN_PARENTHESES
public static final String CLOSE_PARENTHESES
public static String replace(String originalPattern, String newPattern, String originalString)
public static String replaceToken(String original, String token, String replacement)
original
string with the %token%
(if it exists) replaced with the replacement
string. If original
or %token%
are
null, then returns the original
string.public static String replaceCRToken(String original)
original
string with the '%CR%' tokens
(if it exists) replaced with the new line character.public static String wrapText(String inString, String newline, int wrapColumn)
inString
- Text which is in need of word-wrapping.newline
- The characters that define a newline.wrapColumn
- The column to wrap the words at.public static String processCaseTreatment(String str, CaseTreatment caseTreatment)
public static String toString(Object object)
public static String toStringOrEmpty(Object object)
public static String singleQuote(String text)
text
- public static boolean isNotBlank(Object text)
public static boolean ifNotBlank(String text, Consumer<String> consumer)
text
- consumer
- public static boolean noneBlank(String... text)
public static boolean allEquals(String value, String... strings)
public static boolean equalsAnyIgnoreCase(String val, String... strings)
val
- string to look forstrings
- possibilitiespublic static boolean equalsAnyIgnoreCase(String val, String toCheck)
val
- string to look fortoCheck
- string to checkpublic static String concat(Object... osToString)
public static String concatWithSpaces(Object... osToString)
@Deprecated public static String emptyIfNull(Object obj)
obj
- public static boolean isWildcardOrNull(String txt)
public static String prepareForNumericParsing(String inputStr)
inputStr
- public static String nullIfEmpty(String txt)
txt
- public static String boxify(char boxing, String text)
boxing
- boxing character, eg '+'text
- public static boolean anyEmpty(String... strings)
strings
- Copyright © 2006–2022 Appendium - Portfolio Financing Platform. All rights reserved.