Substring.Index Property

property Index: Integer read GetIndex write SetIndex;

The 1-based start of the window in the underlying text.

Returns: Integer

Remarks:

Setting it moves the window and keeps its length, cut at the text's end; a value below 1 is taken as 1, and a start past the text's end raises ESubstringRangeError.

Examples

Moving the window back over a dropped prefix.

uses Substr;

procedure Example;
var s: Substring;
begin
    s := Substring('abcdef');
    s.TrimLeft(2);
    Assert(s.Index = 3);
    s.Index := 1;
    Assert(s = 'abcd');
end;