Is there a function that joins a string into a delimited string?
Emacs has string-join
since 24.4 as part of subr-x.el
:
(eval-when-compile (require 'subr-x))
(string-join '("one" "two" "three") ", ") ; ==> "one, two, three"
subr-x.el
contains also other useful (string manipulation) functions - from the 24.4 release notes:
New library subr-x.el for misc helper functions
hash-table-keys
hash-table-values
string-blank-p
string-empty-p
string-join
string-reverse
string-trim-left
string-trim-right
string-trim
string-remove-prefix
string-remove-suffix
I think you are looking for mapconcat:
mapconcat
applies function to each element of sequence: the results, which must be strings, are concatenated. Between each pair of result strings,mapconcat
inserts the string separator. Usually separator contains a space or comma or other suitable punctuation.