fn:indexOf tag of Function Tag Library
What is "fn:indexOf" tag of Function Tag Library?
Explanation
"fn:indexOf" is a string function of JSP Standard Tag Library(JSTL). This function is used to get the index of the first occurence of the substring in the given string.The function returns -1, if the string is not found.
Syntax:
integer:fn:indexOf(string,substring)
In the above syntax the "string" and "substring" is of data type "String". It returns a integer value. Example :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>
Index of "n" in the string "indiancity"
::${fn:indexOf("indiancity","n")}
Result :
Index of "n" in the string "indiancity"::1
In the above example we found the index value of the first occurence of the substring "n" in the string "indiancity".