Clojure-strings-join

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

Clojure-文字列結合

(seq collection)によって返されるコレクション内のすべての要素のストリングを、オプションのセパレーターで区切って返します。

構文

構文は次のとおりです。

(join sep col)

パラメータ-「sep」はコレクション内の各要素の区切り文字です。 「col」は要素のコレクションです。

戻り値-結合された文字列。

Clojureでの結合の例を次に示します。

(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println (clojure.string/join ", " [1 2 3])))
(hello-world)

出力

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

1 , 2 , 3