I am currently building an app which will be used to time a race.
All the times are saved in a .txt file in this format.
STARTOFEVENT,20/11/2011 11:04:58
0,20/11/2011 11:05:14
1,20/11/2011 11:05:17,00:00:02
2,20/11/2011 11:05:19,00:00:04
3,20/11/2011 11:05:20,00:00:05
4,20/11/2011 11:05:21,00:00:06
5,20/11/2011 11:05:22,00:00:07
What I need help with is displaying the position number (column 1) and finish time (column 3) in a textView / editText as the results come in.
I have tried to a bit of code for parsing CSV files but with no luck.
Example of
split(...)…Each part of the string
csvRecordseparated by a comma is allocated to an element of thecsvFieldsarray. The number of array elements is dependent on the number of csv fields and is handled by thesplit(...)method which dynamically creates the array with the correct number.From the above,
csvFields[0]will be1withcsvFields[1]as20/11/2011 11:05:17andcsvFields[2]will be00:00:02