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?


source to share

1 answer

Yes, use std.array.join


import std.array, std.stdio;

void main()
    auto x = ["a", "b", "c"];


Note that the order of D's arguments is different compared to Python.



All Articles