|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.thymeleaf.util.StringUtils
public final class StringUtils
Utility methods for String objects.
This class is used as a basis for the methods offered by
Strings
, which in turn are the
methods offered by the #strings utility object in variable
expressions.
Method Summary | |
---|---|
static String |
abbreviate(Object target,
int maxSize)
|
static String |
append(Object target,
String suffix)
|
static String |
capitalize(Object target)
Convert the first letter of target to uppercase (title-case, in fact). |
static String |
capitalizeWords(Object target)
Convert all the first letter of the words of target to uppercase (title-case, in fact). |
static String |
capitalizeWords(Object target,
Object delimiters)
Convert all the first letter of the words of target to uppercase (title-case, in fact), using the specified delimiter chars for determining word ends/starts. |
static String |
concat(Object... values)
|
static String |
concatReplaceNulls(String nullValue,
Object... values)
|
static Boolean |
contains(Object target,
String fragment)
|
static Boolean |
containsIgnoreCase(Object target,
String fragment,
Locale locale)
|
static Boolean |
endsWith(Object target,
String suffix)
|
static Boolean |
equals(Object first,
Object second)
|
static Boolean |
equalsIgnoreCase(Object first,
Object second)
|
static String |
escapeJava(Object target)
Escapes the specified target text as required for Java code. |
static String |
escapeJavaScript(Object target)
Escapes the specified target text as required for JavaScript code. |
static String |
escapeXml(Object target)
XML-escapes the specified text. |
static Integer |
indexOf(Object target,
String fragment)
|
static Boolean |
isEmpty(Object target)
Deprecated. Will be removed with the current signature in 2.1.x. This method's signature will be modified to "boolean isEmpty(final String target)". |
static boolean |
isEmptyOrWhitespace(String target)
|
static String |
join(Iterable<?> target,
String separator)
|
static String |
join(Object[] target,
String separator)
|
static Integer |
length(Object target)
|
static String |
prepend(Object target,
String prefix)
|
static String |
randomAlphanumeric(int count)
|
static String |
replace(Object target,
String before,
String after)
|
static String[] |
split(Object target,
String separator)
|
static Boolean |
startsWith(Object target,
String prefix)
|
static String |
substring(Object target,
int beginIndex)
copy a part of target start beginIndex to the end of target. |
static String |
substring(Object target,
int beginIndex,
int endIndex)
|
static String |
substringAfter(Object target,
String substr)
|
static String |
substringBefore(Object target,
String substr)
|
static String |
toLowerCase(Object target,
Locale locale)
|
static String |
toString(Object target)
Performs a null-safe toString() operation. |
static String |
toUpperCase(Object target,
Locale locale)
|
static String |
trim(Object target)
|
static String |
unCapitalize(Object target)
Convert the first letter of target to lowercase. |
static String |
unescapeJava(Object target)
Un-escapes the specified Java-escaped target text back to normal form. |
static String |
unescapeJavaScript(Object target)
Un-escapes the specified JavaScript-escaped target text back to normal form. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String toString(Object target)
Performs a null-safe toString() operation.
target
- the object on which toString will be executed
public static String abbreviate(Object target, int maxSize)
public static Boolean equals(Object first, Object second)
public static Boolean equalsIgnoreCase(Object first, Object second)
public static Boolean contains(Object target, String fragment)
public static Boolean containsIgnoreCase(Object target, String fragment, Locale locale)
public static Boolean startsWith(Object target, String prefix)
public static Boolean endsWith(Object target, String suffix)
public static String substring(Object target, int beginIndex, int endIndex)
public static String substring(Object target, int beginIndex)
copy a part of target start beginIndex to the end of target. If non-String object, toString() will be called.
target
- source of the copy.beginIndex
- index where the copy start.
public static String substringAfter(Object target, String substr)
public static String substringBefore(Object target, String substr)
public static String prepend(Object target, String prefix)
public static String append(Object target, String suffix)
public static String concat(Object... values)
public static String concatReplaceNulls(String nullValue, Object... values)
public static Integer indexOf(Object target, String fragment)
@Deprecated public static Boolean isEmpty(Object target)
public static boolean isEmptyOrWhitespace(String target)
public static String join(Object[] target, String separator)
public static String join(Iterable<?> target, String separator)
public static String[] split(Object target, String separator)
public static Integer length(Object target)
public static String replace(Object target, String before, String after)
public static String toUpperCase(Object target, Locale locale)
public static String toLowerCase(Object target, Locale locale)
public static String trim(Object target)
public static String capitalize(Object target)
Convert the first letter of target to uppercase (title-case, in fact).
target
- the String to be capitalized. If non-String object, toString()
will be called.
public static String unCapitalize(Object target)
Convert the first letter of target to lowercase.
target
- the String to be uncapitalized. If non-String object, toString()
will be called.
public static String capitalizeWords(Object target)
Convert all the first letter of the words of target to uppercase (title-case, in fact). The default delimiter characters between the words are the whitespace characters (see Characters.IsWhiteSpace method in the Java doc).
target
- the String to be capitalized. If non-String object, toString()
will be called.
public static String capitalizeWords(Object target, Object delimiters)
Convert all the first letter of the words of target to uppercase (title-case, in fact), using the specified delimiter chars for determining word ends/starts.
target
- the String to be capitalized. If non-String object, toString()
will be called.delimiters
- delimiters of the words. If non-String object, toString()
will be called.
public static String escapeXml(Object target)
XML-escapes the specified text.
target
- the text to be escaped
public static String escapeJavaScript(Object target)
Escapes the specified target text as required for JavaScript code.
target
- the text to be escaped
public static String escapeJava(Object target)
Escapes the specified target text as required for Java code.
target
- the text to be escaped
public static String unescapeJavaScript(Object target)
Un-escapes the specified JavaScript-escaped target text back to normal form.
target
- the text to be unescaped
public static String unescapeJava(Object target)
Un-escapes the specified Java-escaped target text back to normal form.
target
- the text to be unescaped
public static String randomAlphanumeric(int count)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |