Clojure – Strings join

Clojure strings join

In this guide, we will discuss Clojure Strings join. Returns a string of all elements in collection, as returned by (seq collection), separated by an optional separator.

Syntax

Following is the syntax.

(join sep col)

Parameters − ‘sep’ is the separator for each element in the collection. ‘col’ is the collection of elements.

Return Value − A joined string.

Example

Following is an example of join in Clojure.

(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println (clojure.string/join ", " [1 2 3])))
(hello-world)

Output

The above program produces the following output.

1 , 2 , 3

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply