Clojure-strings-trimr

提供:Dev Guides
2020年6月22日 (月) 22:43時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

Clojure-文字列トリマー

文字列の右側から空白を削除します。

構文

構文は次のとおりです。

(trimr str)

パラメータ-「str」は入力文字列です。

戻り値-文字列の末尾から空白が削除された文字列。

Clojureのトリマーの例を次に示します。

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

出力

上記のプログラムは、次の出力を生成します。

White spaces

上記の出力では、文字列の先頭に空白が含まれます。