Registriert seit: 25. Feb 2003
Ort: St. Ingbert
211 Beiträge
Delphi 7 Enterprise
|
Re: Problem mit If schleife ...
24. Okt 2003, 20:18
Nein, habe ich auch schon getestet. ich poste nochmal die ganze funktion, vieleicht liegt der fehler ja sonstwo ...
Delphi-Quellcode:
// logfile auf "[Time] [Tag] und String" durchsuchen
function ReadString(path : string) : string;
const
searchstring = '[bla] + blaa bluuuub:';
var
list, newlist : TStringList;
z1,datum,release : string;
i,p1,p2 : integer;
begin
list := TStringList.Create;
newlist := TStringList.Create;
// StringList sortieren und keine doppelten Strings hinzufügen
newlist.Sorted := True;
newlist.Duplicates := dupIgnore;
newlist.CaseSensitive := False;
list.LoadFromFile(path);
// Release parsen
for i := 0 to list.Count-1 do
begin
p1 := Pos(searchstring,list[i]);
if p1 = 0 then continue;
z1 := list.Strings[i];
p1 := Pos('[',z1);
p2 := Pos(']',z1);
datum := Copy(z1,p1+1,(p2-p1)-1);
p1 := Pos(searchstring,z1);
z1 := Copy(z1,p1+length(searchstring)+1,length(z1));
p2 := Pos(' ',z1);
release := Copy(z1,1,p2-1);
newlist.Add(datum+' '+release)
end;
result := newlist.CommaText;
list.free;
newlist.free;
end;
Programming today is a race between Software Engineers striving to build bigger and better idiot-proof Programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning!
|
|
Zitat
|