sorting arrays of strings, deleting items from array...
Bill Lear
rael at see.sig.com
Mon Jan 22 18:01:12 PST 2007
I have a map of sha1 values to file names, thus:
char[][][char[]] sha_map;
I would like to loop over the values of the map, and print
the file names that are duplicates, sort of like this:
foreach (key; sha_map.keys) {
auto file_names = sha_map[key];
// if only one file name, it is unique, so skip it
if (file_names.length <= 1) continue;
// sort file names by criteria that place the file
// to retain at the front of the array.
sort(file_names, retain_criteria_comparator());
foreach (i, file_name; file_names) {
if (i == 0) continue;
writefln(file_name);
}
}
But I'm at a loss how to do the sort I would like. Any advice would
be appreciated.
Bill
--
r * e * @ * o * y * a * c * m
* a * l * z * p * r * . * o *
More information about the Digitalmars-d
mailing list