目录

split

在正则表达式上拆分字符串。

语法 (Syntax)

以下是语法。

(split str reg)

Parameters - 'str'是需要拆分的字符串。 'reg'是字符串拆分需要发生的正则表达式。

Return Value - 拆分字符串。

例子 (Example)

以下是Clojure中拆分的示例。

(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println (clojure.string/split "Hello World" #" ")))
(hello-world)

输出 (Output)

上述程序产生以下输出。

[Hello World]

请注意,在上面的输出中,字符串“Hello”和“World”都是单独的字符串。

↑回到顶部↑
WIKI教程 @2018