{=== Funktion zählt die Anzahl der durch ZEICHEN getrennten Teilstrings =======================}
{=== innerhalb des Eingabestrings INP =========================================================}
function countstr(inp : ansistring;zeichen:ansistring):word;
var zaehler, i : word;
begin
if empty(inp) then begin
countstr := 0;
exit;
end;
zaehler := 0;
repeat
i := pos(zeichen,inp);
if i > 0 then begin
inp := copy(inp,i+1,length(inp)-i);
inc(zaehler);
end;
until i = 0;
result := zaehler +1;
end;
{=== Funktion gibt den mit Nummer gekennzeichneten Teilstring zurück. Die =====================}
{=== Teilstrings müssen durch ZEICHEN getrennt sein ==========================================}
function parsestr(inp : ansistring;zeichen:ansistring;nummer : word) : ansistring;
var
zaehler,i : word;
h_str : ansistring;
begin
if empty(inp) then begin
result := '';
exit;
end;
zaehler := 0;
repeat
inc(zaehler);
i := pos(zeichen,inp);
if i > 0 then begin
h_str := copy(inp,1,i-1);
inp := copy(inp,i+1,length(inp)-i);
end else begin
h_str := inp
end;
until (zaehler = nummer) or (i = 0);
result := h_str;
end;