<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
1 字符串连接
${"abc".concat("123")}
2 split
<c:forEach items="${fn:split(‘1,2,3‘, ‘,‘)}" var="str"></c:forEach>
3 length
${fn:length("abc")}
${fn:length(fn:split("a,b,c", ","))}
4 substring
${fn:substring("abc", 0, fn:length("abc"))}
5 contains
${fn:contains("abc", "a")} (containsIgnoreCase)
不能用于数组、集合(用于数组、集合时,会用对象toString后的字符串来执行,显然不准确)
6 replace
${fn:replace("abbc", "b", "B")}
时间: 2024-11-08 15:53:55