fn:substringBefore tag of Function Tag Library

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

Explanation

"fn:substringBefore" is a string function of JSP Standard Tag Library(JSTL). This function is used to extract a portion of string preceding the substring specified.

Syntax:


String:fn:substringBefore(string,substring)

In the above syntax the "string" and "substring" is of Data type "String".

Example :


<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>
<p><b>Characters preceding "is"::</b></p>
${fn:substringBefore('indiaisacountry','is')}

Result


Characters preceding "is"::
india

In the above example we have extracted the characters preceding the substring "is" from the string "indiaisacountry".

Ask Questions

Ask Question