Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function TrimLeft: Substring; overload; | The text without the characters <= ' ' at its start. |
| 2 | procedure TrimLeft(const CharCount: Integer); overload; | Moves the window's start CharCount characters on, copying nothing. |
| 3 | function TrimLeft(const TrimChars: array of Char): Substr.Substring; overload; | The text without the characters of TrimChars at its start. |
Overload 1: function TrimLeft: Substring; overload;
The text without the characters <= ' ' at its start.
Returns: Substring - The part, as Mid returns it.
Examples
Leading spaces removed.
uses Substr;
procedure Example;
begin
Assert(Substring(' ab ').TrimLeft = 'ab ');
end;
Overload 2: procedure TrimLeft(const CharCount: Integer); overload;
Moves the window's start CharCount characters on, copying nothing.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | CharCount | Integer |
Result: stored in self (calling object)
Remarks:
CharCount must lie in 0 .. Length, else ESubstringRangeError is raised. The underlying text stays, so Index can move the window back.
Examples
Dropping a prefix.
uses Substr;
procedure Example;
var s: Substring;
begin
s := Substring('abcdef');
s.TrimLeft(2);
Assert(s = 'cdef');
end;
Overload 3: function TrimLeft(const TrimChars: array of Char): Substr.Substring; overload;
The text without the characters of TrimChars at its start.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | TrimChars | array of Char |
Returns: Substring - The part, as Mid returns it.
Examples
A leading run removed.
uses Substr;
procedure Example;
begin
Assert(Substring('xxab').TrimLeft(['x']) = 'ab');
end;