I haven't worked this low level and I am wondering how to do this.
I receive daily a CSV file of about 5000 lines. I need to check for duplicates in a particular column. I have two ideas on how to go about doing this. One way of doing this could be to iterate through the file adding the column value to a TStringList if it is not already in the list. If there's already a value in the TStringList, add the value to a TStringList that contains duplicates. The above method I would only iterate through the file once.
A second method could be making two loops, the first to iterate through the file and a second loop iterating throught the file looking for the current value. If there is a match then add to a TStringList.
Which is the better method? Which is faster? Can anyone share some code if they have done something similiar?
Thanks,
Rewdee
I receive daily a CSV file of about 5000 lines. I need to check for duplicates in a particular column. I have two ideas on how to go about doing this. One way of doing this could be to iterate through the file adding the column value to a TStringList if it is not already in the list. If there's already a value in the TStringList, add the value to a TStringList that contains duplicates. The above method I would only iterate through the file once.
A second method could be making two loops, the first to iterate through the file and a second loop iterating throught the file looking for the current value. If there is a match then add to a TStringList.
Which is the better method? Which is faster? Can anyone share some code if they have done something similiar?
Thanks,
Rewdee