joiner correct usage

lomereiter lomereiter at gmail.com
Wed Dec 25 10:48:51 PST 2013


On Wednesday, 25 December 2013 at 18:41:47 UTC, H. S. Teoh wrote:
>
> 	import std.array : array;
> 	import std.algorithm : joiner;
> 	string joined = joiner(["hello", "world"], " ").array;
>
>
> T

Ha!
>  Error: cannot implicitly convert expression 
> (array(joiner(["hello", "world"], " "))) of type dchar[] to 
> string

std.conv.to should be used instead:

     import std.conv : to;
     string joined = joiner(["hello", "world"], " ").to!string;



More information about the Digitalmars-d-learn mailing list