English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JSTL fn:endsWith() system

مكتبة العلامات القياسية لـ JSP

يستخدم نظام fn:endsWith() لتحديد ما إذا كانت نصًا ينتهي بأي جزء معين.

النظام

نظام fn:endsWith() syntax as follows:

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

مثال عرض

هذا المثال يعرض وظيفة هذه الوظيفة:

<%@ 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</title>
</head>
<body>
<c:set var="theString" value="I am from w3codebox 123"/>
<c:if test="${fn:endsWith(theString, '123')}">
   <p>السلسلة تنتهي بـ 123</p>
</c:if>
<c:if test="${fn:endsWith(theString, 'hooo')}">
   <p>السلسلة تنتهي بـ w3codebox</p>
</c:if>
</body>
</html>

نتائج التنفيذ كما يلي:

السلسلة تنتهي بـ 123

مكتبة العلامات القياسية لـ JSP