Substr.LeftStr Method

function LeftStr(const AText: Substring; const ACount: Integer): Substring; overload; inline;

The first ACount characters of AText.

#NameTypeDescription
1ATextSubstring
2ACountInteger

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

Remarks:

An ACount outside 0 .. Length raises ESubstringRangeError.

Examples

The first characters.

uses Substr;

procedure Example;
begin
    Assert(LeftStr(Substring('abcdef'), 2) = 'ab');
end;