JSP/JSTL functions

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

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

 


 

fn:contains()

  • 입력 문자열에 지정된 하위 문자열이 포함되어 있는지 테스트합니다.

 

Syntax

boolean contains(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 contains</title>
    </head>
    <body>
        <c:set var="str" value="Hello World."/>

        <c:if test="${fn:contains(str, 'hello')}">
            <p>Found 'hello' string<p>
        </c:if>

        <c:if test="${fn:contains(str, 'Hello')}">
            <p>Found 'Hello' string<p>
        </c:if>
   </body>
</html>

 

Result

Found 'Hello' String.

 


 

728x90
728x90
LIST