拆分字符串基于转义字符\n或\r\n。
以下是语法。
(split-lines str)
参数 - " str"是需要分割的字符串。
返回值 - 拆分字符串。
以下是Clojure中的分割线示例。
(ns clojure.examples.hello (:gen-class)) (defn hello-Learnfk [] (println (clojure.string/split-lines "Hello\nLearnfk"))) (hello-Learnfk)
上面的程序产生以下输出。
[Hello Learnfk]
请注意,在上面的输出中,字符串" Hello"和" Learnfk"都是单独的字符串。
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)