Clojure – Strings trim

Clojure strings trim

In this guide, we will discuss Clojure Strings trim. Removes whitespace from both ends of the string.

Syntax

Following is the syntax.

(trim str)

Parameters βˆ’ β€˜str’ is the input string.

Return Value βˆ’ The string which has the whitespaces removed.

Example

Following is an example of trim in Clojure.

(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println (clojure.string/trim " White spaces ")))
(hello-world)

Output

The above program produces the following output.

White spaces

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply