JSTL fn:subStringAfter() function

The JSTL fn:subStringAfter() function returns a sub string of the input string after a specified string.

Syntax:

Strung subStringAfter(String inputString, String specifiedString)

Example:

test.jsp

<%@ 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>fn:substringAfter JSTL function example</title>
	</head>
	<body>
		<c:set var="testString"
                         value="Hello this is a JSTL function example."/>
		Given String: <br/>
		<c:out value="${testString}" /><br/><br/>
		Substring After Hello:<br/>
		<c:out value="${fn:substringAfter(testString, 'Hello')}"/>
	</body>
</html>

web.xml

<web-app>
 
  <welcome-file-list>
          <welcome-file>test.jsp</welcome-file>
  </welcome-file-list>	
 
</web-app>

Output:

jsp example 62   Download this example.

Related Topics:

  Next Topic: JSTL fn:subStringBefore() function with example. Previous Topic: JSTL fn:subString() function with example.

 

Please follow and like us:
Content Protection by DMCA.com