的FN:containsIgnoreCase()函数确定的输入字符串是否包含指定的子串。在进行搜索时,它会忽略大小写。
该FN:containsIgnoreCase()函数的语法如下-
boolean containsIgnoreCase(java.lang.String, java.lang.String)
以下是解释fn:containsIgnoreCase()函数功能的示例-
<%@ 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:containsIgnoreCase(theString, 'test')}"> <p>Found test string<p> </c:if> <c:if test = "${fn:containsIgnoreCase(theString, 'TEST')}"> <p>Found TEST string<p> </c:if> </body> </html>
您将收到以下结果-
Found test string Found TEST string