JSTL - containsIgnoreCase()

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

Syntax:

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" %>
<html>
<head>
<title>JSTL Tutorial</title>
</head>
<body>
<c:set var="str" value="Suresh marks : 190"/>
<c:if test="${fn:containsIgnoreCase(str, 'marks')}">
   <p>Lower Case String<p>
</c:if>
<c:if test="${fn:containsIgnoreCase(str, 'MARKS')}">
   <p>Upper Case String<p>
</c:if>
</body>
</html>

Output :

Lower Case String
Upper Case String