Substr.MidStr Method

function MidStr(const AText: Substring; const AStart, ACount: Integer): Substring; overload; inline;

ACount characters of AText from AStart (1-based).

#NameTypeDescription
1ATextSubstring
2AStartInteger
3ACountInteger

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

Remarks:

A range outside the text raises ESubstringRangeError.

Examples

A part from a 1-based start.

uses Substr;

procedure Example;
begin
    Assert(MidStr(Substring('abcdef'), 2, 3) = 'bcd');
end;