Hello folks, I’m having difficulty in sorting a two-dimensional array. Right now, it looks something like this:
…etc.
For the moment, I’d like to sort by author first, then by program, but I’d also like this system to be somewhat flexible so that I can change the sort order later. I have gotten this list to sort properly if I leave out the “notes” portion and place the Author, Program, and Date fields on a single, tab-delimited line, but I’d like to know how to sort by a particular element of a two-dimensional array so that I can leave the notes where they are.
Thanks!
-Meatsim
Code:
Author[0] | Program[1] | Date[2] | Notes[3 – end]
jdoe sample.c 01/01/01 A sample program[3] That does things[4]
jeffk l33t.c 03/25/00 Another Program[3]
…etc.
For the moment, I’d like to sort by author first, then by program, but I’d also like this system to be somewhat flexible so that I can change the sort order later. I have gotten this list to sort properly if I leave out the “notes” portion and place the Author, Program, and Date fields on a single, tab-delimited line, but I’d like to know how to sort by a particular element of a two-dimensional array so that I can leave the notes where they are.
Thanks!
-Meatsim