Clojure - Strings reverse


Advertisements

Reverses the characters in a string.

Syntax

Following is the syntax.

(reverse str)

Parameters − ‘str’ is the string which needs to be reversed.

Return Value − The reversed string.

Example

Following is an example of reverse in Clojure.

(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println (reverse "Hello World")))
(hello-world)

Output

The above program produces the following output.

(d l r o W   o l l e H)                                                        
clojure_strings.htm
Advertisements