Clojure - 字串 triml



從字串左側移除空白字元。

語法

以下是語法。

(triml str)

引數 − ‘str’ 是輸入字串。

返回值 − 從字串開頭移除空白字元後的字串。

示例

以下是 Clojure 中 triml 的示例。

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

輸出

以上程式產生以下輸出。

White spaces

以上輸出將在字串末尾保留空格。

clojure_strings.htm
廣告