uses StrUtils;
function ReversePos(SubStr, S: String): Integer;
var
i : Integer;
begin
i := Pos(ReverseString(SubStr), ReverseString(S));
if i > 0 then i := Length(S) - i - Length(SubStr) + 2;
Result := i;
end;
调用的例子:
ShowMessage (IntToStr(ReversePos(‘abc‘, ‘abc123abc456‘)));