Clojure-strings-count

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

Clojure-文字列カウント

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

構文

構文は次のとおりです。

(count stringvariable)

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

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

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

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

出力

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

5