fn:endsWith tag of Function Tag Library

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

Explanation

"fn:endsWith" is a string function of JSP Standard Tag Library(JSTL). This function is used to check if the "string" ends with the given "suffix".

Syntax:


boolean:fn:endsWith(string,suffix)

In the above syntax the "string" and "suffix" are of data type "String". It returns a boolean value.

Example :


<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>
The Suffix of "HioxIndia" is "a"::
<c:out value="${fn:endsWith(HioxIndia,a)}"/>
Result :

The Suffix of "HioxIndia" is "a":: true

In the above example we checked whether the string "HioxIndia" has the suffix "a". Since it's correct the function returns "true".

Ask Questions

Ask Question