function GetSubstring(const Src: string; const SrcIdx, SrcLen: Integer): Substring; overload;
A view of SrcLen characters of Src from SrcIdx (1-based), copying none: Subrange as a function.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Src | string | |
| 2 | SrcIdx | Integer | |
| 3 | SrcLen | Integer |
Returns: Substring - The view; it is valid while Src lives unchanged.
Remarks:
Src takes every text kind. The range must lie inside Src, else ESubstringRangeError is raised.
Examples
A view of a string's value part.
uses Substr;
procedure Example;
var Text: string;
begin
Text := 'key=value';
Assert(GetSubstring(Text, 5, 5) = 'value');
end;