JSTL fn:subString() function

The JSTL fn:subString() function returns a sub string of the input string from the start index to the last index-1.

Syntax:

String subString(String inputString, int startIndex, int lastIndex)

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" %>


	
		fn:substring JSTL function example
	
	
		
		Given String: 


Substring of the given string:

web.xml


	
  
          test.jsp
  	


Output:

jsp example 61
 
Download this example.
 
Next Topic: JSTL fn:subStringAfter() function with example.
Previous Topic: JSTL fn:replace() function with example.