본문 바로가기
JSP/JSTL functions

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

by 지니★ 2021. 7. 30.
728x90
728x90
SMALL

 


 

fn:startsWith()

  • 입력 문자열이 지정된 접두사로 시작하는지 테스트합니다.

 

Syntax

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

 

Example

<%@ 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>Using JSTL Functions</title>
   </head>

   <body>
      <c:set var = "string" value = "Second: This is first String."/>
      
      <c:if test = "${fn:startsWith(string, 'First')}">
         <p>String starts with First</p>
      </c:if>
      
      <br />
      <c:if test = "${fn:startsWith(string, 'Second')}">
         <p>String starts with Second</p>
      </c:if>
   
   </body>
</html>

 

Result

String starts with Second

 


 

728x90
728x90
SMALL

'JSP > JSTL functions' 카테고리의 다른 글

[JSP][JSTL functions] fn:substringAfter()  (0) 2021.07.30
[JSP][JSTL functions] fn:substring()  (0) 2021.07.30
[JSP][JSTL functions] fn:split()  (0) 2021.07.30
[JSP][JSTL functions] fn:replace()  (0) 2021.07.26
[JSP][JSTL functions] fn:length()  (0) 2021.07.26

댓글