Einzelnen Beitrag anzeigen

Benutzerbild von thkerkmann
thkerkmann

Registriert seit: 7. Jan 2006
Ort: Pulheim Brauweiler
464 Beiträge
 
Delphi 2010 Professional
 
#2

Re: Daten aus ASCII Dateien auslesen

  Alt 24. Dez 2007, 11:17
Hi,

also ich würd's so machen:
Delphi-Quellcode:
var
  sl: tStringlist;
  s: string;
  sCode: string;
  sPosition: string;
  sText: string;
  sEuro: string;
begin
  sl := tStringlist.Create;
  try
    sl.LoadFromFile(dieDatei);

    for i:=0 to sl.Count-1 do
    begin
      s := sl.Strings[i];
      sCode := copy(s,1,2);
      if sCode='10then
      begin
        // Anfang
        sPosition := '';
        sText := '';
        sEuro := '';
      end
      else if sCode='11then
        sPosition := copy(s,3,maxint)
      else if sCode='12then
        sText := copy(s,3,maxint)
      else if sCode='13then
        sEuro := copy(s,3,maxint)
      else if sCode='20then
      begin
        // eintragen der drei variablen in stringgrid oder was auch immer
      end;
    end;
  finally
    sl.Free;
  end;
end;
Frohes Fest
Thomas Kerkmann
Ich hab noch einen Koffer in Borland.
http://thomaskerkmann.wordpress.com/
  Mit Zitat antworten Zitat