Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function TrimRight: Substring; overload; | The text without the characters <= ' ' at its end. |
| 2 | procedure TrimRight(const CharCount: Integer); overload; | Moves the window's end CharCount characters back, copying nothing. |
| 3 | function TrimRight(const TrimChars: array of Char): Substr.Substring; overload; | The text without the characters of TrimChars at its end. |
Overload 1: function TrimRight: Substring; overload;
The text without the characters <= ' ' at its end.
Returns: Substring - The part, as Mid returns it.
Examples
Trailing spaces removed.
uses Substr;
procedure Example;
begin
Assert(Substring(' ab ').TrimRight = ' ab');
end;
Overload 2: procedure TrimRight(const CharCount: Integer); overload;
Moves the window's end CharCount characters back, 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.
Examples
Dropping a suffix.
uses Substr;
procedure Example;
var s: Substring;
begin
s := Substring('abcdef');
s.TrimRight(2);
Assert(s = 'abcd');
end;
Overload 3: function TrimRight(const TrimChars: array of Char): Substr.Substring; overload;
The text without the characters of TrimChars at its end.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | TrimChars | array of Char |
Returns: Substring - The part, as Mid returns it.
Examples
Trailing dots removed.
uses Substr;
procedure Example;
begin
Assert(Substring('ab..').TrimRight(['.']) = 'ab');
end;