02-17-2014, 06:48 AM
If I have a one dimensional array and a string that get's it content changed, those 2 items must be put in a ICsv object.
What is the best (fastest/efficient) way to set (initiate) the ICsv object?
To be more clear, the beneath example:
1 dimensional array = in_extracted_sections[ ]
string that changes = extracted_section_content
Those 2, I want to put in the ICsv object v
To set the ICsv object, I use:
Macro Macro23
(I set the columns on '2' and the 'length' to the length of the 1 dim Array in_extracted_sections[ ])
Macro Macro23
My question: Is the above way, the correct way to setup the ICsv object? (using temporary 2 dim Array "tmp_arr").
Or is there something faster/better I could with:
What is the best (fastest/efficient) way to set (initiate) the ICsv object?
To be more clear, the beneath example:
1 dimensional array = in_extracted_sections[ ]
string that changes = extracted_section_content
Those 2, I want to put in the ICsv object v
To set the ICsv object, I use:
Macro Macro23
;; The temporary array that 'sets' ICsv
ARRAY(str) tmp_arr.create(2 in_extracted_sections.len)
Macro Macro23
int i
str in_settingsfile_content
str extracted_section_content ;; The string that changes (this will be put in the ICsv)
ARRAY(str) in_extracted_sections.create(2) ;; The array (this will be put in the ICsv)
in_extracted_sections[0]="path"
in_extracted_sections[1]="file_locations"
in_settingsfile_content=
;[path]
;c:\test
;;
;[file_locations]
;1a*E:\__qm_testdirs\test_ini_1.txt
;2a*E:\__qm_testdirs\test_ini_2.txt
;; The temporary array that 'sets' ICsv
ARRAY(str) tmp_arr.create(2 in_extracted_sections.len)
ICsv v=CreateCsv()
str output_string
v.FromArray(tmp_arr)
v.Separator="|"
int nr=v.RowCount
int nc=v.ColumnCount
int r c
for i 0 in_extracted_sections.len
,findrx(in_settingsfile_content F"(?s)^\Q[{in_extracted_sections[i]}]\E(.+?)(?:^\[|\z)" 0 8 extracted_section_content 1)
,extracted_section_content.trim
,v.Cell(i 0)=in_extracted_sections[i]
,v.Cell(i 1)=extracted_section_content
,v.ToString(output_string)
,
out output_string
My question: Is the above way, the correct way to setup the ICsv object? (using temporary 2 dim Array "tmp_arr").
Or is there something faster/better I could with: