Substring.Substring Method

Overload List

#SignatureDescription
1function Substring(const StartIndex: Integer): Substr.Substring; overload;The text from StartIndex (0-based) to the end, or Length characters from StartIndex.
2function Substring(const StartIndex, Length: Integer): Substr.Substring; overload;

Overload 1: function Substring(const StartIndex: Integer): Substr.Substring; overload;

The text from StartIndex (0-based) to the end, or Length characters from StartIndex.

#NameTypeDescription
1StartIndexInteger

Returns: Substring - The part, as Mid returns it.

Remarks:

A range outside the text raises ESubstringRangeError.

Examples

The end of a text, and a part of it.

uses Substr;

procedure Example;
begin
    Assert(Substring('abcdef').Substring(4) = 'ef');
    Assert(Substring('abcdef').Substring(1, 2) = 'bc');
end;

Overload 2: function Substring(const StartIndex, Length: Integer): Substr.Substring; overload;

#NameTypeDescription
1StartIndexInteger
2LengthInteger

Returns: Substring