kk, hat sich erledigt, das funktioniert:
Delphi-Quellcode:
function pos(sub, s: string; const cs: boolean = false): integer;
var
tmp: string;
idx: integer;
i, sublen: integer;
begin
result := 0; idx := 0;
if (sub <> '') and (s <> '') then
begin
while ((length(s) >= length(sub))) and (result = 0) do
begin
sublen := length(sub);
setstring(tmp, pchar(s), sublen);
inc(idx);
if ((cs) and (lstrcmp(pchar(tmp), pchar(sub)) = 0)) or
((not cs) and (lstrcmpi(pchar(tmp), pchar(sub)) = 0)) then
begin
result := idx;
exit;
end;
if length(s) >= 2 then
begin
for i := 2 to length(s) do
s[i-1] := s[i];
setlength(s, length(s)-1);
end
else exit;
end;
end;
end;
byebye