fn:contains() 函数判断一个输入字符串是否包含一个指定的子串。
语法
使用 fn:contains() 函数具有以下语法:
boolean contains(java.lang.String, java.lang.String)
例子:
下面是例子来说明这个函数的功能:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %><html><head><title>Using JSTL Functions</title></head><body> <c:set var="theString" value="I am a test String"/> <c:if test="${fn:contains(theString, ‘test‘)}"> ?? <p>Found test string<p> </c:if> <c:if test="${fn:contains(theString, ‘TEST‘)}"> ?? <p>Found TEST string<p> </c:if></body></html>
这将产生以下输出结果:
Found test string
JSTL fn:contains()函数
原文地址:http://www.cnblogs.com/henuyuxiang/p/7613801.html