Einzelnen Beitrag anzeigen

omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#7

Re: Algorithmus zum ermitteln von Parametern

  Alt 19. Jun 2006, 16:40
So, hab mich auch nochmal dran versucht...

Delphi-Quellcode:
procedure ReadParams(Text:string; Params:TStrings);
var p:string;
    i:integer;
    Quot:boolean;
begin
  Quot:=false;
  p:='';
  for i:=1 to length(Text) do begin
    case Text[i] of
      '-','/': if not Quot then begin
                 if trim(p) <> 'then
                   Params.Append(trim(p));
                 p:='';
               end;
      '"': Quot:=not Quot;
      ' ': if not Quot then begin
                 if trim(p) <> 'then
                   Params.Append(trim(p));
                 p:='';
               end;
    end;
    p:=p + Text[i];
  end;
  if trim(p) <> 'then
    Params.Append(trim(p));
end;
  Mit Zitat antworten Zitat