fn:substring tag of Function Tag Library

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


"fn:substring" is a function of JSP Standard Tag Library(JSTL). This function is used to extract a string specified using the two index values "begin" and "end". If the index values is less than "0" the function takes it as "0", if more than the length of the string the function returns an empty string. Otherwise displays the values between "begin" and "end".



In the above syntax the "string" is of Data type "String", "begin" and "end" is of data type "int".

Example :

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>
<p><b>Extract 'tree' from 'trees'::</b></p>


Extract 'tree' from 'trees'::

In the above example we have extracted the substring "tree" from the string "trees" by giving the begining value to "0", ending value "4".

Ask Questions

Ask Question