Voilà une superbe fonction déposée par
foxi mais comme
il est occupé à faire ses bd..
function TFAlarme.Parser(const Chaine, Separat: string; const Occurence: cardinal = 1): string;
var
i, p1, p2, ld: integer;
begin
Result := '';
if (posex(Separat, Chaine[1]) = 1) and (Occurence <= 1) then exit;
p1 := 1;
ld := Length(Separat);
for I := 1 to Occurence - 1 do
begin
p1 := posex(Separat, Chaine, p1);
if P1 = 0 then
exit
else
p1 := p1 + ld;
end;
p2 := posex(Separat, Chaine, p1);
if p2 = 0 then
p2 := length(Chaine) + 1;
Result := copy(Chaine, p1, p2 - p1);
end;
cantador
