var sltDest: TStringList; sourcefile: TextFile; sLine: String; begin AssignFile(sourcefile,'c:\1.csv'); sltDest := TStringList.Create; try Reset(sourcefile); while not eof(sourcefile) do begin readln(sourcefile, sLine); sltDest.text := sLine; sltDest.Strings[i];//i is the specified field. end; finally CloseFile(sourcefile); slDest.Free; end; end;
sourcefile: TextFile;
sLine: String;
begin
AssignFile(sourcefile,'c:\1.csv');
sltDest := TStringList.Create;
try
Reset(sourcefile);
while not eof(sourcefile) do begin
readln(sourcefile, sLine);
sltDest.text := sLine;
sltDest.Strings[i];//i is the specified field.
end;
finally
CloseFile(sourcefile);
slDest.Free;
end;
end;