
June 3rd, 2004, 12:52 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
comparing data in an array
Hi I have a csv containing postcodes like this:
"Perth", 6666
"Melbourne", 7777
\
etc.
I have loaded these values into an array like so.
var
i : integer;
s : string;
my_postcodes: TStringList;
begin
assign(myfile,'postcodes.csv');
reset(myfile);
my_postcodes := TStringList.Create;
while not eof(myfile) do
begin
readln(myfile, line);
my_postcodes.DelimitedText := line;
for i := 0 to my_postcodes.Count - 1 do
begin
s := my_postcodes.Strings[i];
s := my_postcodes[i]; // Same as previous line
end;
end;
Does anyone know how I can choose a certain field from the array i.e. If i want to know the postcode for perth, how do I extract that information from the array and put it into a variable. I am really stuck!! Any help appreciated.
|