Java jstl function substringafter

The fn:substringAfter function is a JSTL function that returns a substring of the input string that follows the first occurrence of a specified delimiter. The function takes two arguments: the input string and the delimiter.

The syntax of the fn:substringAfter function is as follows:

refer to:‮igi‬ftidea.com
${fn:substringAfter(string, delimiter)}

where string is the input string and delimiter is the delimiter to search for.

For example, the following expression returns the substring that follows the first occurrence of the delimiter "," in the input string "hello, world":

${fn:substringAfter("hello, world", ",")}

This expression returns the string " world".

You can also use variables instead of literals for the arguments. For example, if you have a variable text containing a string and a variable delimiter containing the delimiter to search for, you can get the substring using the following expression:

${fn:substringAfter(text, delimiter)}

This expression returns the substring of the string stored in the text variable that follows the first occurrence of the delimiter stored in the delimiter variable.

Note that the fn tag library must be imported at the beginning of the JSP page using the following tag:

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>