Append array of strings in d
In python, I can do this:
In [1]: x = ["a", "b", "c"]
In [2]: "--".join(x)
Out[2]: 'a--b--c'
Is there an equivalent trick in d?
+3
qed
source
to share
1 answer
Yes, use std.array.join
:
import std.array, std.stdio;
void main()
{
auto x = ["a", "b", "c"];
writeln(x.join("--"));
}
Note that the order of D's arguments is different compared to Python.
+6
Vladimir Panteleev
source
to share