function TStr.copyRigth(const Str, SubStr: string;
Index: Integer): string;
var
i: Integer;
begin
i := posEx(SubStr, Str, Index);
if i > 0 then
result := copy(Str, i + length(SubStr), maxint)
else
result := '';
end;
function TStr.copyRigth(const Str: string;
Index: Integer): string;
begin
result := copy(Str, Index, maxint);
end;
function TStr.posEx(const SubStr, Str: string;
const Index: Integer; const IsUpper: Boolean;
const Supportwildcard: Boolean): Integer;
var
lSubStr, lStr: string;
i, j, m, n, lIndex: Integer;
begin
result := 0;
//
lSubStr:= SubStr;
lStr:= Str;
lIndex:= Index;
if IsUpper then
begin
lSubStr:= toUpper(SubStr);
lStr:= toUpper(Str);
end;
//
m := length(lStr) + 1;
n := length(lSubStr) + 1;
i := 1;
while i < m do
begin
j := 1;
while j < n do
begin
if ((i+j-1) < m) and
((Supportwildcard and (lSubStr[j] = '?')) or
(lSubStr[j] = lStr[i+j-1])) then
inc(j)
else
break;
end;
if j < n then
inc(i)
else
begin
dec(lIndex);
if lIndex = 0 then
break
else
inc(i);
end;
end;
if i < m then result := i;
end;