ufmetrix.blogg.se

Delphi read csv file
Delphi read csv file












Please enable JavaScript for best user experience. Otherwise the GetValue function is a safe wrapper to access the contents of the array.Bitte aktivieren Sie JavaScript, um alle Möglichkeiten dieser Seite nutzen zu können. If you are 100% sure that you don't exceed the boundaries of the array you can access it directly. ParseFile parses the file and returns it in a two-dimensional dynamic array. IF Paragraph>=LENGTH(ARR) THEN SetLength(ARR,SUCC(Paragraph)) įUNCTION GetValue(CONST ARR : TTwoDimIntArr Chapter,Paragraph : Cardinal) : Cardinal ĮLSE IF Paragraph>=LENGTH(ARR) THENįUNCTION ParseFile(CONST FileName : STRING) : TTwoDimIntArr IF Chapter>=LENGTH(ARR) THEN SetLength(ARR,SUCC(Chapter)) PROCEDURE SetValue(VAR ARR : TTwoDimIntArr Chapter,Paragraph,Value : Cardinal) TTwoDimIntArr = ARRAY OF ARRAY OF Cardinal 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. So in the example above, I'd like to pass 2,2 to a function and have it return "51" (integer) The CSV file is sorted numerically, that is: 1,1,30 // first paragraph of first chapter (line # 1)ġ,2,56 // second paragraph of first chapter (line # 2)ġ00,23,78 // last paragraph of last chapter (line # 1500) 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).

delphi read csv file

The CSV file exists in format of:Ĭhapter number, Paragraph number, Total number of words in the paragraph

delphi read csv file

I have the need to be able to quickly identify a value from a CSV file (less than 15kb in size).

delphi read csv file

I am looking for advice on how to best handle a programming task using Delphi 7.














Delphi read csv file