I work in VB.net only. I cal read an entire file in one statement, sort it with another statement and write it bacl in another. Three statements to sort a csv file! This is aswome, but I wan to know how to sort the file on different columns. Here is my code,
Dim codes(), Saveline As String
'
'Read/Write file data
'
codes = File.ReadAllLines(FileName)
'
'Save sorted copy
'
Saveline = codes(0)
codes(0) = ""
Array.Sort(codes)
codes(0) = Saveline
'
File.WriteAllLines(FileName, codes)
What I want to do is use array.sort(codes,2)
where the 2 is column 2 or any other column. Obviously this doesnt work or I wouldn't be here. Is there a way to do this with the Array call?
Thanks!