hey /prog/, I only started programming a couple months ago, so sorry for being a complete noob, but in VB 2008 can I read a file with io.streamreader, and sort every other line alphabetically? ie. name data name 2 data 2 names alphabetically keeping data in order thanks, in return I offer my gratitude
1)in place? it just needs to be sorted alphabetically, with the corresponding data still with the name it was originally with.
2)no, from a .txt
3)Its just a .txt, no encoding
>>8 1)in place? it just needs to be sorted alphabetically, with the corresponding data still with the name it was originally with.
You don't know what `in place' means.
3)Its just a .txt, no encoding
There's no such thing as `just a .txt', as far as programming is concerned. If the file is not just a sequence of random bytes, there is some encoding.
Also, drop VB and read SICP now].
Name:
Anonymous2008-11-20 18:32
Use a List of KeyValuePairs of String, String. Read the first line and use as a key, then read the second line and use as the value. Add to the list. Repeat until the end of the file.
Then sort the list using its built in method, specifying a comparer function that compares just the keys of the KeyValuePairs.
Now do whatever you needed to do with that sorted list .. print it, write it back to a file, etc.