JSP/JSTL functions

[JSP][JSTL functions] fn:endsWith()

지니★ 2021. 7. 25. 22:50
728x90
728x90
SMALL

 


 

fn:endsWith()

  • 입력 문자열이 지정된 접미사로 끝나는지 테스트합니다.

 

Syntax

boolean endsWith(java.lang.String, java.lang.String)

 

Example

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
    <head>
        <title>JSTL functions endsWith</title>
    </head>
    <body>
        <c:set var="str" value="Hello World."/>

        <c:if test="${fn:endsWith(str, 'World')}">
            <p>String ends with 'World'<p>
        </c:if>

        <c:if test="${fn:endsWith(str, 'World.')}">
            <p>String ends with 'World.'<p>
        </c:if>
   </body>
</html>

 

Result

String ends with 'World.'

 


 

728x90
728x90
LIST