Clojure - String trim



從字串兩端去除空格。

語法

語法如下。

(trim str)

引數 – 'str' 是輸入字串。

返回值 – 去除空格的字串。

示例

以下是在 Clojure 中 trim 的一個示例。

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

輸出

上述程式產生以下輸出。

White spaces
clojure_strings.htm
廣告