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

-- 
One reason that few people are aware there are programs running the internet is 
that they never crash in any significant way: the free software underlying the 
internet is reliable to the point of invisibility. -- Glyn Moody, from the 
article "Giving it all away"

Reply via email to