JSP/JSTL functions

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

지니★ 2021. 7. 26. 13:56
728x90
728x90
SMALL

 


 

fn:join()

  • 배열의 모든 요소를 ​​문자열로 결합합니다.

 

Syntax

java.lang.String join(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 join</title>
    </head>
    <body>
        <c:set var="str1" value="Hello World."/>
        
        <p>Before : ${str3}</p>
        
        <c:set var="str2" value="${fn:split(str1, ' ')}"/>
        <c:set var="str3" value="${fn:join(str2, '-')}"/>
        
        <p>After : ${str3}</p>
   </body>
</html>


Result

Before : Hello World.
After : Hello-World.

 


 

728x90
728x90
LIST

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

[JSP][JSTL functions] fn:replace()  (0) 2021.07.26
[JSP][JSTL functions] fn:length()  (0) 2021.07.26
[JSP][JSTL functions] fn:indexOf()  (0) 2021.07.26
[JSP][JSTL functions] fn:escapeXml()  (0) 2021.07.26
[JSP][JSTL functions] fn:endsWith()  (0) 2021.07.25