Clojure - Strings
A String literal is constructed in Clojure by enclosing the string text in quotations. Strings in Clojure need to be constructed using the double quotation marks such as “Hello World”.
Following is an example of the usage of strings in Clojure.
(ns clojure.examples.hello (:gen-class)) (defn hello-world  (println "Hello World") (println "This is a demo application")) (hello-world)
The above program produces the following output.
Hello World This is a demo application
Basic String Operations
Clojure has a number of operations that can be performed on strings. Following are the operations.
|Sr.No.||String Operations & Description|
The concatenation of strings can be done by the simple str function.
The formatting of strings can be done by the simple format function. The format function formats a string using java.lang.String.format.
Returns the number of characters in the string.
Returns the substring of ‘s’ beginning at start inclusive, and ending at end (defaults to length of string), exclusive.
Returns a negative number, zero, or a positive number when ‘x’ is logically 'less than', 'equal to', or 'greater than' ‘y’.
Converts string to all lower-case.
Converts string to all upper-case.
Returns a string of all elements in collection, as returned by (seq collection), separated by an optional separator.
Splits string on a regular expression.
Split strings is based on the escape characters \n or \r\n.
Reverses the characters in a string.
Replaces all instance of a match in a string with the replacement string.
Removes whitespace from both ends of the string.
Removes whitespace from the left hand side of the string.
Removes whitespace from the right hand side of the string.