RPos

文字列の右から検索する Pos 関数。

function ReverseString(const S: string): string;
var
  I, L: Integer;
begin
  SetLength(Result, Length(S));
  L := Length(S);

  for I := 0 to L - 1 do
    Result[L - I] := S[I + 1];
end;

function RPos(Substr: string; S: string): Integer;
begin
  Result := Pos(ReverseString(Substr), ReverseString(S));
  if Result <> 0 then Result := Length(S) - (Result - 1) - (Length(Substr) - 1);
end;

Return index page