El function library (provided by JSTL)
* Import Tag library: <%@ tablib prefix= "FN" uri= "Http://java.sun.com/jsp/jstl/functions"%>
String toUpperCase (String input): Converts a parameter to uppercase
String toLowerCase (String input): Converts arguments to lowercase
int indexOf (string input, String substring): From a large string, output a small string of positions!
Boolean contains (string input, String substring): To see if a string is included in a large string
Boolean containsignorecase (string input, string substring): Ignores case, contains
Boolean StartsWith (string input, String substring): is prefixed with a small string
Boolean EndsWith (string input, string substring): Whether to use small strings as suffixes
String substring (string input, int beginindex, int endIndex): Intercept substring
String Substringafter (string input, string substring): Gets the string that follows the position of the small string in a large string
Substringbefore (string input, string substring): Gets the string in front of the small string in the large string
String EscapeXML (String input): Escapes input "<", ">", "&", "" "," ""
String trim (String input): Remove spaces before and after
String replace (string input, String substringbefore, String substringafter): Replace
String[] Split (string input, string delimiters): Splits a string to get an array of strings
int length (Object obj): You can get the lengths of strings, arrays, various collections!
String join (String array[], string separator): union string Array!
Here is an example:
1 <%@taglib prefix="fn"URI="http://java.sun.com/jsp/jstl/functions" %>2 ... ..3 string[] STRs = {"A", "B", "C"};4 List List = new ArrayList ();5 List.add ("a");6 Pagecontext.setattribute ("arr", STRs);7 pagecontext.setattribute ("list", list);8 %>9${fn:length (ARR)}<BR/><!--3 -Ten${fn:length (List)}<BR/><!--1 - One${fn:tolowercase ("Hello")}<BR/> <!--Hello - A${fn:touppercase ("Hello")}<BR/> <!--HELLO - -${fn:contains ("abc", "A")}<BR/><!--true - -${fn:containsignorecase ("abc", "Ab")}<BR/><!--true - the${fn:contains (arr, "a")}<BR/><!--true - -${fn:containsignorecase (list, "A")}<BR/><!--true - -${fn:endswith ("Hello.java", ". Java")}<BR/><!--true - -${fn:startswith ("Hello.java", "Hell")}<BR/><!--true - +${fn:indexof ("Hello-world", "-")}<BR/><!--5 - -${fn:join (arr, ";")}<BR/><!--a;b;c - +${fn:replace ("Hello-world", "-", "+")}<BR/><!--Hello+world - A${fn:join (Fn:split ("A;B;C;", ";"), "-")}<BR/><!--a-b-c - at -${fn:substring ("0123456789", 6, 9)}<BR/><!--678 - -${fn:substring ("0123456789", 5,-1)}<BR/><!--56789 - -${fn:substringafter ("Hello-world", "-")}<BR/><!-- World - -${fn:substringbefore ("Hello-world", "-")}<BR/><!--Hello - -${fn:trim ("a b C")}<BR/><!--a b c - in${fn:escapexml ("<HTML></HTML>")}<BR/> <!-- -
Revisit the JSP learning note--el function library