On Sunday, 21 September 2014 at 23:50:50 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Sun, Sep 21, 2014 at 11:41:56PM +0000, AsmMan via
Digitalmars-d-learn wrote:
I'd like to copy an array string into a appender!string() but
I can't
see how to do this without loop myself over the string array.
Is there
a native function or should I write it myself?
Try this:
import std.array : appender;
import std.algorithm : joiner, copy;
string[] arr = ["ab", "cd", "efg"];
auto app = appender!string();
arr.joiner.copy(app);
assert(app.data == "abcdefg");
T
FYI, that's probably scary expensive in terms of
encoding/decoding.
Using the "free" std.range.put should take care of everything,
natively.