Print int[string] sorted by Value

aberba karabutaworld at gmail.com
Wed Oct 28 15:40:23 UTC 2020


On Wednesday, 28 October 2020 at 15:15:40 UTC, Paul wrote:
> per the D sample wc2.d....
> size_t[string] dictionary;  <-is printed by...
> .....
> foreach (word1; dictionary.keys.sort) writef ....etc
>
> I want to print the dictionary sorted by value not key.  I can 
> write an algorithm but is there a library method(s) I can use 
> to iterate through the array sorted by decreasing values?
>
> Thanks for your time.

Have you tries .values() function? dictionary.values.sort()


More information about the Digitalmars-d-learn mailing list