Ada*_*der 16 string vector clojure
我想连接存储在向量中的字符串.例如,如果我["a" "b" "c"]在矢量中,我希望得到结果"abc".
mty*_*aka 33
您可以使用apply该str功能:
(apply str ["a" "b" "c"])
Run Code Online (Sandbox Code Playgroud)
Ser*_*gey 18
你可以使用clojure.string连接函数
(clojure.string/join ["a" "b" "c"])
Run Code Online (Sandbox Code Playgroud)
这是Clojure减少的方法之一.请注意Clojure的REPL会话:
[dsm@localhost:~]$ clj
Clojure 1.4.0
user=> (reduce str ["a" "b" "c"])
"abc"
user=>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9870 次 |
| 最近记录: |