- uri="http://java.sun.com/jsp/jstl/functions" prefix="FN" %>
- The above URI depends on your actual situation.
- ${fn:substring ("The string you want to intercept"), Beginindex,endindex}
- User reply: Can intercept, with the FN function:
- <%@ taglib prefix="FN" uri="Http://java.sun.com/jsp/jstl/functions" %>
- The following is a list of the methods that are in Jstl and their descriptions
- Function Name Function Description Use example
- Fn:contains determines whether a string contains another string <c:if Test="${fn:contains (name, searchstring)} ">
- Fn:containsignorecase determines whether a string contains another string (case-insensitive) <c:ifTest="${ Fn:containsignorecase (name, SearchString)} ">
- Fn:endswith determines whether the string ends with a different string <c:if Test="${fn:endswith (filename,". TXT ")}">
- Fn:escapexml convert some characters into XML representations, such as the < character should be converted to < ${fn:escapexml (Param:info)}
- The position of the fn:indexof substring in the parent string ${fn:indexof (name, "-")}
- Fn:join union the data in the array into a new string and uses the specified character format to open ${fn:join (array, ";")}
- Fn:length gets the length of the string, or the size of the array ${fn:length (shoppingcart.products)}
- Fn:replace replaces the character specified in the string ${fn:replace (text, "-", "?")}
- Fn:split the string according to the specified word segmentation ${fn:split (customernames, ";")}
- Fn:startswith determines whether the string starts with a substring <c:if Test= "${fn:startswith (product.id," ")}">
- Fn:substring Get substring ${fn:substring (zip, 6,-1)}
- Fn:substringafter gets the substring starting at the location of a character
- ${fn:substringafter (Zip, "-")}
- Fn:substringbefore Gets the substring ${fn:substringbefore (zip, "-") from the beginning to the location of a character}
- Fn:tolowercase converted to lowercase ${fn.tolowercase (product.name)}
- Fn:touppercase to uppercase characters ${FN. Uppercase (Product.name)}
- Fn:trim Remove the space before and after the string ${fn.trim (name)}
- Function
- Describe
- Fn:contains (string, substring)
- Returns true if the parameter string contains the parameter substring.
- Fn:containsignorecase (string, substring)
- Returns true if the parameter string contains the parameter substring (ignoring case)
- Fn:endswith (string, suffix)
- Returns true if the argument string ends with the argument suffix
- Fn:escapexml (String)
- Convert XML (and HTML) of extraordinary significance to the corresponding XML character entity code, and return
- Fn:indexof (string, substring)
- Returns the position of the first occurrence of the parameter substring in the parameter string
- Fn:join (array, separator)
- Separator a given array array together with the given spacer, forming a new string and returning it.
- Fn:length (item)
- Returns the number of elements contained in the parameter item. The parameter item type is an array, a collection, or a string. If it is of type string, the return value is the number of characters in string.
- Fn:replace (String, before, after)
- Returns a String object. Replaces all occurrences of a parameter before string in a parameter string with a parameter after string, and returns the replaced result
- Fn:split (string, separator)
- Returns an array that splits the argument string with the parameter separator, and each part of the split is an element of the array
- Fn:startswith (string, prefix)
- If the argument string starts with the argument prefix, returns true
- Fn:substring (string, begin, end)
- Returns the string part of the argument, starting with the argument begin to the end position of the argument, including the character of the end position
- Fn:substringafter (string, substring)
- Returns the part of the string that follows the parameter substring in the argument string
- Fn:substringbefore (string, substring)
- Returns the part of the string that precedes the argument substring in the argument string
- Fn:tolowercase (String)
- Converts all characters of the argument string to lowercase and returns it
- Fn:touppercase (String)
- Converts all characters of the argument string to uppercase and returns it
- Fn:trim (String)
- Strips the argument string from the end of the space and returns it
Examples of Use
<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%><%@ taglib uri= "http://java.sun.com/jsp/ Jstl/functions " prefix=" FN "%>
Jstl fn:substring () function code and usage-Returns a subset of the start and end indexes of a specified string.