JSTL – containsIgnoreCase()

The fn:containsIgnoreCase() function determines whether an input string contains a specified substring. While doing search it ignores the case.


The fn:containsIgnoreCase() function has following syntax:

boolean containsIgnoreCase(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" %>

<title>JSTL Tutorial</title>

<c:set var="str" value="Suresh marks : 190"/>

<c:if test="${fn:containsIgnoreCase(str, 'marks')}">
   <p>Lower Case String<p>

<c:if test="${fn:containsIgnoreCase(str, 'MARKS')}">
   <p>Upper Case String<p>


Output :

Lower Case String
Upper Case String