在正则表达式上拆分字符串。
以下是语法。
链接:https://www.learnfk.comhttps://www.learnfk.com/clojure/clojure-strings-split.html
来源:LearnFk无涯教程网
(split str reg)
参数 - " str"是需要分割的字符串, " reg"是需要进行字符串拆分的正则表达式。
返回值 - 拆分字符串。
以下是Clojure中拆分的示例。
(ns clojure.examples.hello (:gen-class)) (defn hello-Learnfk [] (println (clojure.string/split "Hello Learnfk" #" "))) (hello-Learnfk)
上面的程序产生以下输出。
[Hello Learnfk]
请注意,在上面的输出中,字符串" Hello"和" Learnfk"都是单独的字符串。
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Python实战 · 从0到1搭建直播视频平台 -〔Barry〕