目录

count

要查找字符串中的字符数,可以使用count函数。

语法 (Syntax)

以下是语法。

(count stringvariable)

Parameters - 'Stringvariable,是需要确定字符数的字符串。

Return Value - 字符串中的字符数。

例子 (Example)

以下是Clojure中字符串格式的示例。

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

输出 (Output)

上述程序产生以下输出。

5
↑回到顶部↑
WIKI教程 @2018