Print int[string] sorted by Value
Paul
phshaffer at gmail.com
Wed Oct 28 16:30:55 UTC 2020
On Wednesday, 28 October 2020 at 15:40:23 UTC, aberba wrote:
> Have you tries .values() function? dictionary.values.sort()
Thanks aberba. Yes, that was my first attempt!
If my terminology is correct that gives me a "range" of sorted
VALUES.
I think I can't "iterate"(foreach) through an array of VALUE[KEY]
using the VALUE. I can only iterate over the KEYS...maybe?
If my array is of type int[string] I can do:
foreach(word-STRING, range-of-STRINGS)
writeln(dictionary[word-STRING]);
but not:
foreach(value-INT, range-of-VALUES)
writeln(dictionary[value-INT]<- wrong type);
More information about the Digitalmars-d-learn
mailing list