亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

JSTL fn:contains()函數(shù)

JSP 標準標簽庫

fn:contains()函數(shù)用于確定一個字符串是否包含指定的子串。

語法

fn:contains()函數(shù)的語法如下:

<c:if test="${fn:contains(<原始字符串>, <要查找的子字符串>)}">
...
</c:if>

示例演示

以下示例演示了這個函數(shù)的功能:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ 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>使用 JSTL 函數(shù)</title>
</head>
<body>
<c:set var="theString" value="I am from nhooo"/>
<c:if test="${fn:contains(theString, 'nhooo')}">
   <p>找到 nhooo<p>
</c:if>
<c:if test="${fn:contains(theString, 'nhooo')}">
   <p>找到 nhooo<p>
</c:if>
</body>
</html>

運行結果如下:

找到 nhooo

JSP 標準標簽庫