Package org.zkoss.xel.fn
Class StringFns
- java.lang.Object
-
- org.zkoss.xel.fn.StringFns
-
public class StringFns extends java.lang.Object
Functions to manipulate strings in EL.- Author:
- tomyeh
-
-
Constructor Summary
Constructors Constructor Description StringFns()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
cat(java.lang.Object o1, java.lang.Object o2)
Concatenates two objects.static java.lang.String
cat3(java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)
Concatenates three objects.static java.lang.String
cat4(java.lang.Object o1, java.lang.Object o2, java.lang.Object o3, java.lang.Object o4)
Concatenates four objects.static java.lang.String
cat5(java.lang.Object o1, java.lang.Object o2, java.lang.Object o3, java.lang.Object o4, java.lang.Object o5)
Concatenates five objects.static java.lang.String
eatQuot(java.lang.String s)
Eliminates single and double quotations to avoid JavaScript injection.static boolean
endsWith(java.lang.String s1, java.lang.String s2)
Tests if this string ends with the specified suffix.static java.lang.String
join(java.lang.Object[] ss, java.lang.String separator)
Joins an array of string.static java.lang.String
replace(java.lang.String src, java.lang.String from, java.lang.String to)
Replaces all occurrences of 'from' in 'src' with 'to'static java.lang.String[]
split(java.lang.String s, java.lang.String separator)
Splits a string.static boolean
startsWith(java.lang.String s1, java.lang.String s2)
Tests if this string starts with the specified prefix.static java.lang.String
substring(java.lang.String s, int from, int to)
Returns a new string that is a substring of this string.static java.lang.String
toLowerCase(java.lang.String s)
Converts all of the characters in this String to upper case using the rules of the current Locale.static java.lang.String
toUpperCase(java.lang.String s)
Converts all of the characters in this String to upper case using the rules of the current Locale.static java.lang.String
trim(java.lang.String s)
Returns a copy of the string, with leading and trailing whitespace omitted.
-
-
-
Method Detail
-
cat
public static java.lang.String cat(java.lang.Object o1, java.lang.Object o2)
Concatenates two objects. Note: null is considered as empty.
-
cat3
public static java.lang.String cat3(java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)
Concatenates three objects. Note: null is considered as empty.
-
cat4
public static java.lang.String cat4(java.lang.Object o1, java.lang.Object o2, java.lang.Object o3, java.lang.Object o4)
Concatenates four objects. Note: null is considered as empty.
-
cat5
public static java.lang.String cat5(java.lang.Object o1, java.lang.Object o2, java.lang.Object o3, java.lang.Object o4, java.lang.Object o5)
Concatenates five objects. Note: null is considered as empty.
-
toLowerCase
public static java.lang.String toLowerCase(java.lang.String s)
Converts all of the characters in this String to upper case using the rules of the current Locale.- Since:
- 5.0.7
- See Also:
Locales.getCurrent()
-
toUpperCase
public static java.lang.String toUpperCase(java.lang.String s)
Converts all of the characters in this String to upper case using the rules of the current Locale.- Since:
- 5.0.7
- See Also:
Locales.getCurrent()
-
trim
public static java.lang.String trim(java.lang.String s)
Returns a copy of the string, with leading and trailing whitespace omitted.- Since:
- 5.0.7
-
split
public static java.lang.String[] split(java.lang.String s, java.lang.String separator)
Splits a string.- Since:
- 5.0.7
-
join
public static java.lang.String join(java.lang.Object[] ss, java.lang.String separator)
Joins an array of string. since 5.0.7
-
startsWith
public static boolean startsWith(java.lang.String s1, java.lang.String s2)
Tests if this string starts with the specified prefix.- Since:
- 5.0.7
-
endsWith
public static boolean endsWith(java.lang.String s1, java.lang.String s2)
Tests if this string ends with the specified suffix.- Since:
- 5.0.7
-
substring
public static java.lang.String substring(java.lang.String s, int from, int to)
Returns a new string that is a substring of this string.- Since:
- 5.0.7
-
replace
public static java.lang.String replace(java.lang.String src, java.lang.String from, java.lang.String to)
Replaces all occurrences of 'from' in 'src' with 'to'
-
eatQuot
public static java.lang.String eatQuot(java.lang.String s)
Eliminates single and double quotations to avoid JavaScript injection. It eliminates all quotations. In other words, the specified string shall NOT contain any quotations.It is used to avoid JavaScript injection. For example, in DSP or JSP pages, the following codes is better to escape with this method.
- Since:
- 3.5.2
-
-