OCaml类似于Python的String join方法

时间:2017-01-06 18:05:16

标签: ocaml

给定Python中的字符串元素列表,我可以使用指定的粘合剂连接这些元素。例如:

"phd in everything"

评估字符串packagingOptions { exclude 'AUTHORS' // will not include AUTHORS file }

OCaml中哪种类似物被认为是最惯用的?也就是说,如何将列表中的字符串元素与OCaml中的某些指定字符串连接起来?

1 个答案:

答案 0 :(得分:4)

Ocaml中的等价物是:

#String.concat " " ["phd"; "in"; "everything"]

对列表的长度没有限制。