public final class Strings extends Object
Modifier and Type | Method and Description |
---|---|
static String |
abbreviate(String text,
int size)
Abbreviate the given text on the given size limit with ellipsis.
|
static String |
capitalize(String string)
Capitalize the given string, i.e.
|
static String |
concat(Object left,
Object right)
Concatenate the string representation of the given objects.
|
static String |
encodeURL(String string)
URL-encode the given string using UTF-8.
|
static String |
escapeJS(String string)
Escapes the given string according the JavaScript code rules.
|
static String |
format1(String pattern,
Object param1)
Format the given string with 1 parameter.
|
static String |
format2(String pattern,
Object param1,
Object param2) |
static String |
format3(String pattern,
Object param1,
Object param2,
Object param3) |
static String |
format4(String pattern,
Object param1,
Object param2,
Object param3,
Object param4) |
static String |
format5(String pattern,
Object param1,
Object param2,
Object param3,
Object param4,
Object param5) |
static String |
prettyURL(String string)
URL-prettify the given string.
|
public static String abbreviate(String text, int size)
text
- The text to be abbreviated.size
- The size limit of the text.public static String concat(Object left, Object right)
null
, otherwise the new EL 2.2
#{bean.string1.concat(bean.string2)}
can just be used.left
- The left hand.right
- The right hand.public static String capitalize(String string)
string
- The string to be capitalized.public static String prettyURL(String string)
string
- The string to be prettified.public static String encodeURL(String string)
<f:param>
.string
- The string to be URL-encoded.UnsupportedOperationException
- When this platform does not support UTF-8.public static String escapeJS(String string)
string
- The string to be escaped according the JavaScript code rules.public static String format1(String pattern, Object param1)
Faces.getLocale()
. Design notice:
There are five formatX() methods, each taking 1 to 5 format parameters because EL functions does not support
varargs methods nor overloaded function names.pattern
- The format pattern.param1
- The first parameter.MessageFormat
public static String format2(String pattern, Object param1, Object param2)
format1(String, Object)
public static String format3(String pattern, Object param1, Object param2, Object param3)
format1(String, Object)
public static String format4(String pattern, Object param1, Object param2, Object param3, Object param4)
format1(String, Object)