I am looking for advice on how to best handle a programming task using Delphi 7.
I have the need to be able to quickly identify a value from a CSV file (less than 15kb in size). The CSV file exists in format of:
Chapter number, Paragraph number, Total number of words in the paragraph
I want to be able to retrieve this last value, i.e., the number of words, by providing a function the first two values (i.e., the chapter and paragraph number).
The CSV file is sorted numerically, that is:
1,1,30 // first paragraph of first chapter (line # 1)
1,2,56 // second paragraph of first chapter (line # 2)
1,3,101
1,4,56
...
2,1,78
2,2,51
...
100,1,87
100,2,101
...
100,23,78 // last paragraph of last chapter (line # 1500)
So in the example above, I'd like to pass 2,2 to a function and have it return "51" (integer)
I'd like to avoid using a database table because: 1) the amount of data isn't that large (1500 lines in the CSV file, i.e., 1500 paragraphs), 2) the extra overhead of a database engine (I only need to read data, not write data), 3) the frequency that this function will be called from within the program.
What would you recommend, and why?