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

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

JSP 標(biāo)準(zhǔn)標(biāo)簽庫

fn:endsWith()函數(shù)用于確定一個字符串是否以指定后綴結(jié)尾。

語法

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

<c:if test="${fn:endsWith(<原始字符串>, <要查找的子字符串>)}">
...
</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 123"/>
<c:if test="${fn:endsWith(theString, '123')}">
   <p>字符串以 123 結(jié)尾<p>
</c:if>
<c:if test="${fn:endsWith(theString, 'hooo')}">
   <p>字符串以 nhooo 結(jié)尾<p>
</c:if>
</body>
</html>

運(yùn)行結(jié)果如下:

字符串以 123 結(jié)尾

JSP 標(biāo)準(zhǔn)標(biāo)簽庫