PDA

View Full Version : Getting File Data into Array and sorting it?


gorilla1
03-01-2003, 06:34 AM
I have a file with names in it and number of votes received. So each row is: name .... number of votes

I would like to display that as a list with the top vote getter first and then on down in descending order. I have seen sort functions around for multi-dimensional arrays. But I'm not even sure how to get the data into a multi-dimensional array. Do I have to declare it as Dim array(x,y) or something similar? Is there a straightforward way to do this?

G

Mhtml
03-02-2003, 06:10 AM
Firstly may I suggest using a database for this. Sorting is no prob if you do it like that.

Secondly I've never used a multi-dimensional array but I will have to go learn about them now. (Have to know everything :))

The way I'd go about it would be to read the data to a string and then split() it up so that it leaves you only with the numbers in the same order as the names. Then just split() the numbers into another array making it easy to arrange.