What is the string lower-case method in Clojure?
Overview
A string is a sequence of characters enclosed in double quotation marks ("").
One of the methods used to work with strings in Clojure is the string lower-case.
What is the string lower-case?
The string lower-case method converts all characters of a string to the lower case.
Syntax
(lower-case s)
String lower-case syntax
Parameter
The string lower-case method accepts one parameter.
s: This is thestringin the syntax above.
Return value
This method returns a string with all characters in the lower case. Let's see an example.
Example
(ns clojure.examples.hello(:gen-class))(defn EXAMPLE [](println (clojure.string/lower-case "Educative"))(println (clojure.string/lower-case "EDUCATIVE")))(EXAMPLE)
Code explanation
Line 3: We define a function EXAMPLE.
Line 4: We convert the string Educative to educative using the lower-case string method. We nested the clojure.string using the dot notation. This shows that the lower-case method is a core string method of Clojure.
Line 5: We convert EDUCATIVE to educative using the same method as in Line 4.
Line 6: We call our EXAMPLE function.