Clojure-strings-triml

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

Clojure-文字列トリム

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

構文

構文は次のとおりです。

(triml str)

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

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

以下はClojureのtrimlの例です。

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

出力

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

White spaces

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