JSTL – substringAfter()



The fn:substringAfter() function returns the part of a string after a specified substring.

Syntax:

The fn:substringAfter() function has following syntax:

java.lang.String substringAfter(java.lang.String, java.lang.String)

JSTL Example :

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

<html>
<head>
<title>JSTL Tutorial</title>
</head>
<body>

<c:set var="str1" value="www.c4learn.com"/>
<c:set var="str2" value="${fn:substringAfter(str1, 'www.')}" />

<p>Final sub string : ${str2}</p>

</body>
</html>

Output :

Final sub string : c4learn.com