Removind duplicates for JSON string

Imperatorn johan_forsberg_86 at hotmail.com
Sun Nov 1 19:30:01 UTC 2020


On Sunday, 1 November 2020 at 13:31:19 UTC, Anonymouse wrote:
> On Sunday, 1 November 2020 at 09:14:35 UTC, Vino wrote:
>> [...]
>
> I can only test with Phobos (no asdf on run.dlang.io), but 
> isn't just normal sort and uniq what you want?
>
> data[]
>     .array
>     .sort
>     .uniq!((tup1, tup2) => tup1[0] == tup2[0]);
>
> https://run.dlang.io/is/a3KHaE
>
> Sorting "default" values can be tricky but they conveniently 
> cede to explicit D1/Q1/P1 values because of ASCII. Otherwise 
> you would have to provide different sort and uniq predicates.

Tip:
You can find asdf under "Add library" on run.dlang.io


More information about the Digitalmars-d-learn mailing list