Substring.DefaultArray Property

property DefaultArray[const Indx: Integer]: WideChar read GetDefaultArray write SetDefaultArray; default;

The character at Indx, 0-based.

#NameTypeDescription
1IndxInteger

Returns: WideChar

Remarks:

Inline. In a unit compiled with {$C+} the index is checked first (CheckIndex); without it an index outside the text is the caller's defect. A write changes the character where it is, so a copy, part or adopted string that shares it sees the change.

Examples

Reading and writing characters.

uses Substr;

procedure Example;
var s: Substring;
begin
    s := Substring('abc');
    s[0] := 'X';
    Assert(s[0] = 'X');
    Assert(s = 'Xbc');
end;