fn:split tag of Function Tag Library

What is "fn:split" tag of Function Tag Library?

Explanation

"fn:split" is a string function of JSP Standard Tag Library(JSTL). This function is used to split a string to return an array with the given seperator.
string.

Syntax:


String[]:fn:split(string,seperator)

In the above syntax the "string", "seperator" are of Data type "String".

Example :


<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>
<c:set var="str" value="s,p,l,i,t"/>
<p><b>The splitted strings "s,p,l,i,t" using ","::</b></p>
<c:forEach var="splt" items="${fn:split(str, ',')}">
<c:out value="${splt}" />
</c:forEach>

Result


The splitted strings "s,p,l,i,t" using ","::
s p l i t

In the above example the string "s,p,l,i,t" is split using the seperator "," to return an array of strings.

Ask Questions

Ask Question