Making associatvie array from array of pairs

Gary Willoughby dev at nomad.so
Tue Dec 24 03:41:30 PST 2013


On Tuesday, 24 December 2013 at 11:36:23 UTC, Dfr wrote:
> Let's say i have array of kind:
>
> auto a = [["1","0000FF"], ["2", "00FF00"], ...];
>
> Is there simple way to turn it into associative array of kind:
>
> string[string] b = ["1": "0000FF", "2": "00FF00", ...];

You can if the initial array was comprised of tuples instead of 
nested arrays.

http://dlang.org/phobos/std_array.html#.assocArray


More information about the Digitalmars-d-learn mailing list