Clojure-strings-trim

提供:Dev Guides
移動先:案内検索

Clojure-文字列のトリム

文字列の両端から空白を削除します。

構文

構文は次のとおりです。

(trim str)

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

戻り値-空白が削除された文字列。

以下はClojureのトリムの例です。

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

出力

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

White spaces