Reading CSV style file and sorting

Monkey Forums/Monkey Beginners/Reading CSV style file and sorting

probson(Posted January) [#1]
Hi,

Again for my students they have managed to read in a CSV style file.
Has persons name in first place and then score in second.

We have split the data and put it into separate lists. However, unlike Python which they know they can't index this to sort it. They can't use inbuilt sort need to write a merge sort or similar themselves.

So looks like to do this we are going to have to convert it an array and have arr[i],0 as the name and arr[i],1 as the score.

Now in python know how to get this to work easy but not so sure here. This is probably really easy but when you don't know how in this language not sure easy.


Xaron(Posted January) [#2]
Can you post the python code?


Paul - Taiphoz(Posted January) [#3]
Read the file in with a FileStream and ReadString the data into text, once you have the text in a string variable use this to get it into an array lines = String.Split("~n") that will split your cva file into lines, I assume each player score is on its own line, with it now in lines you can do another split on the comma entry = lines.Split(",") entry[0] would be your name and entry[1] would be your score..

Sorry I dont have time to write an example.