public class Format extends Object
Constructor and Description |
---|
Format() |
Modifier and Type | Method and Description |
---|---|
static String |
camelize(String s)
Camel cases the given string.
|
static String |
capitalize(String value)
Capitalizes the first character and lower cases the remaining characters.
|
static String |
currency(double value)
Provides the standard currency format for the default locale.
|
static String |
decimal(double value)
Provides the standard decimal format for the default locale.
|
static String |
ellipse(String value,
int len)
Truncate a string and add an ellipsis ('...') to the end if it exceeds the
specified length.
|
static String |
fileSize(int size)
Returns the file size.
|
static String |
htmlDecode(String value)
Convert certain characters (&, <, >, and ') from their HTML character
equivalents.
|
static String |
htmlEncode(String value)
Convert certain characters (&, <, >, and ') to their HTML character
equivalents for literal display in web pages.
|
static String |
hyphenize(String value)
Replaces camel cases with hyphens.
|
static String |
number(double value,
String format)
Formats the number.
|
static String |
scientific(double value)
Provides the standard scientific format for the default locale.
|
static String |
stripScripts(String v) |
static String |
stripTags(String v) |
static String |
substitute(String text,
int param)
Substitutes the indexed parameters.
|
static String |
substitute(String text,
Map<String,Object> params)
Substitutes the named parameters.
|
static String |
substitute(String text,
Object... params)
Substitutes the indexed parameters.
|
static String |
substitute(String text,
Object param)
Substitutes the indexed parameter.
|
static String |
substitute(String text,
Params params)
Substitutes the parameters.
|
static String |
substitute(String text,
String[] keys,
Map<String,Object> params)
Substitutes the named parameters.
|
public static String camelize(String s)
s
- the stringpublic static String capitalize(String value)
value
- the value to capitalizepublic static String currency(double value)
value
- the valuepublic static String decimal(double value)
value
- the valuepublic static String ellipse(String value, int len)
value
- the string to truncatelen
- the maximum length to allow before truncatingpublic static String fileSize(int size)
size
- the sizepublic static String htmlDecode(String value)
value
- the valuepublic static String htmlEncode(String value)
URL#encode(String)
.value
- the valuepublic static String hyphenize(String value)
value
- the valuepublic static String number(double value, String format)
value
- the numberformat
- the format using the DateTimeFormat
syntax.public static String scientific(double value)
value
- the valuepublic static String substitute(String text, int param)
text
- the textparam
- the parameterpublic static String substitute(String text, Map<String,Object> params)
text
- the textparams
- the parameterspublic static String substitute(String text, Object... params)
text
- the textparams
- the parameterspublic static String substitute(String text, Object param)
text
- the text to formatparam
- the parameter to use, which will replace {0}public static String substitute(String text, Params params)
text
- the textparams
- the parametersCopyright © 2018. All rights reserved.