Clojure - str


Advertisements

The concatenation of strings can be done by the simple str function.

Syntax

Following is the syntax.

str stringvar1 stringvar2 stringvarn

Parameters − You can enter any number of string parameters which need to be concatenated.

Return Value − The return value is a string.

Example

Following is an example of the string concatenation in Clojure.

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

Output

The above program will produce the following output.

HelloWorld
HelloWorldAgain
clojure_strings.htm
Advertisements