Einzelnen Beitrag anzeigen

Dax
(Gast)

n/a Beiträge
 
#8

Re: Schnell Anzahl der Zeilen einer Textfile ermitteln?

  Alt 21. Jan 2005, 15:31
Hmm... so?

Delphi-Quellcode:
var
  Content: string;
  I, LineCount: Integer;
  D: DWORD;
begin
  Content := (Inhalt der Datei);
  LineCount := 0; // Zeilenzahl der Datei
  for I := 0 to Length(Content) div sizeof(D) do
  begin
    Move(Content[I*sizeof(D)+1], D, sizeof(D));
    D := D AND $0D0D0D0D; // Maske. Kommt das Zeichen #$0D (#13) vor, fängt eine neue Zeile an
    if D <> 0 then
    begin
      if D AND $0D = $0D then Inc(LineCount);
      if D AND $0D00 = $0D00 then Inc(LineCount);
      if D AND $0D0000 = $0D0000 then Inc(LineCount);
      if D AND $0D000000 = $0D000000 then Inc(LineCount);
    end;
  end;
end;
  Mit Zitat antworten Zitat