Sorting array of string arrays by an element in the string array
Joel via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Oct 21 17:37:57 PDT 2014
On Wednesday, 22 October 2014 at 00:36:22 UTC, Joel wrote:
> On Wednesday, 22 October 2014 at 00:32:56 UTC, neal wrote:
>> Just curious if this is possible. I have some data on
>> different countries that i have stored in a multidimensional
>> array called data[][]. What I want to do is sort data[][] by
>> population which happens to be stored in data[i][4] where i is
>> the index to iterate from country to country.
>>
>> I would like something like this:
>>
>> sort!("a>b")(data[][4]);
>>
>> Anybody have any suggestions?
>
> More like this:
> sort!(a.country > b.country)(data[][4]);
Oops, forgot the quotes: sort!("a.country >
b.country")(data[][4]);
More information about the Digitalmars-d-learn
mailing list