Clojure-strings-count

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

Clojure-文字列カウント

文字列の文字数を調べるには、count関数を使用できます。

構文

構文は次のとおりです。

(count stringvariable)

パラメータ-'文字列変数は、文字数を決定する必要がある文字列です。

戻り値-文字列の文字数。

以下は、Clojureでの文字列フォーマットの例です。

(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println (count "Hello")))
(hello-world)

出力

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

5