Clojure - 字串 trimr 函式



移除字串右側的空格。

語法

以下是語法。

(trimr str)

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

返回值 − 從字串末尾移除空格後的字串。

示例

以下是 Clojure 中 trimr 函式的示例。

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

輸出

以上程式輸出如下。

White spaces

以上輸出將在字串開頭保留空格。

clojure_strings.htm
廣告