BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

fn:containsIgnoreCase() – JSTL Function

Last Updated: December 1, 2013 by Chaitanya Singh | Filed Under: JSTL

In the last tutorial we learnt about fn:contains() function which is used for case sensitive checking. In this post we are going to see fn:containsIgnoreCase() function which does a case insensitive check to see whether the provided string is a sub-string of input or not.

Syntax:

boolean fn:containsIgnoreCase(String input, String checkstring)

The return type of this function is boolean. Like fn:contains() function it also receives two string arguments and it checks whether the second string is present in the first string(first argument). It doesn’t consider the case during evaluation.

Example of fn:containsIgnoreCase()

In this example we are having two strings – string1 & string2. We are checking whether the string2 is present in string1. If the result is true then we are displaying a message.

<%@ 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:containsIgnoreCase() example</title>
</head>
<body>
<c:set var="string1" value="Hi This is CHAITANYA from BeginnersBook.com"/>
<c:set var="string2" value="chaitanya" />
<c:if test="${fn:containsIgnoreCase(string1, string2)}">
 <c:out value="Case Insensitive Check: String1 contains string2"/>
</c:if>
</body>
</html>

Output:

fn-containsIgnoreCase-example

Top Related Articles:

  1. fn:join() and fn:split() JSTL Functions
  2. fn:substring(), fn:substringAfter() & fn:substringBefore() Functions
  3. fn:toUpperCase() – JSTL Function
  4. fn:indexOf() – JSTL Function
  5. JSTL <c:out> Core Tag

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

JSTL Core Tags

  • c:out
  • c:set
  • c:remove
  • c:if
  • c:choose
  • c:when
  • c:otherwise
  • c:catch
  • c:import
  • c:forEach
  • c:forTokens
  • c:param
  • c:url
  • c:redirect
JSTL Functions
  • fn:contains()
  • fn:containsIgnoreCase()
  • fn:indexOf()
  • fn:escapeXML()
  • fn:join() & fn:split()
  • fn:length()
  • fn:startsWith()
  • fn:endsWith()
  • fn:substring()
  • fn:substringAfter()
  • fn:substringBefore()
  • fn:trim()
  • fn:toUpperCase()
  • fn:toLowerCase()
  • fn:replace()

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap