Substring.Trim Method

Overload List

#SignatureDescription
1function Trim: Substring; overload;The text without the characters <= ' ' at both ends.
2function Trim(const TrimChars: array of Char): Substr.Substring; overload;The text without the characters of TrimChars at both ends.

Overload 1: function Trim: Substring; overload;

The text without the characters <= ' ' at both ends.

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

Examples

Spaces and a tab removed.

uses Substr;

procedure Example;
begin
    Assert(Substring('  a b '#9).Trim = 'a b');
end;
See Also: Substring.Trim, Substring.Trim

Overload 2: function Trim(const TrimChars: array of Char): Substr.Substring; overload;

The text without the characters of TrimChars at both ends.

#NameTypeDescription
1TrimCharsarray of Char

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

Examples

Dashes removed at both ends.

uses Substr;

procedure Example;
begin
    Assert(Substring('--a-b--').Trim(['-']) = 'a-b');
end;