Open In App

JSTL fn:toLowerCase() Function

In JSTL, the fn:toLowerCase function converts all the characters of the input or specified string into the lowercase format. This allows the developers to transform the string case with the JavaServer Pages and also ensures the proper representation of text in lowercase.

In this article, we will see the Syntax along with parameters and also the practical implementation of the function in terms of examples.



Syntax of fn:toLowerCase() Function

${fn:toLowerCase(string)}

Where,

Example of JSTL fn:toLowerCase() Function

In this example, we will discuss the use of fn:toLowerCase() in a code sample with ONLY uppercase letters of a JSP application.






<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ 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 fn:toLowerCase() Example</title>
  </head>
  <body>
    <c:set var="inputString" value="GEEKSFORGEEKS"/>
    <h3>Original String: ${inputString}</h3>
      
    <p>Lowercase String: ${fn:toLowerCase(inputString)}</p>
      
  </body>
</html>

Output:

Original String: GEEKSFORGEEKS
Lowercase String: geeksforgeeks

Output Screen of the JSTL fn:toLowerCase() Function:

Output

Explanation of the above Program:

Example 2:

In this example, we will discuss the use of fn:toLowerCase() in a code sample with a mixed of uppercase and lowercase letters in a JSP application.




<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ 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 fn:toLowerCase() Example</title>
  </head>
  <body>
    <c:set var="inputString" value="GeeKsForGeeks"/>
    <h3>Original String: ${inputString}</h3>
      
    <p>Lowercase String: ${fn:toLowerCase(inputString)}</p>
      
  </body>
</html>

Output:

Original String: GeeKsForGeeks
Lowercase String: geeksforgeeks

Output Screen of the JSTL fn:toLowerCase() Function(Example 2):

Explanation of the above Program:


Article Tags :