Substr.Pos Method

function Pos(const SubStr, Str: Substring; const Offset: Integer): Integer; overload;

The 1-based position of SubStr in Str at or after Offset, 0 if none.

#NameTypeDescription
1SubStrSubstring
2StrSubstring
3OffsetInteger

Returns: Integer

Examples

A position from an offset.

uses Substr;

procedure Example;
begin
    Assert(Pos(Substring('l'), Substring('hello'), 1) = 3);
    Assert(Pos(Substring('l'), Substring('hello'), 4) = 4);
end;