Substring.Remove Method

Overload List

#SignatureDescription
1function Remove(const StartIndex: Integer): Substring; overload;
2function Remove(const StartIndex, Count: Integer): Substring; overload;This string without Count characters at StartIndex, or without everything from StartIndex; this string is unchanged.

Overload 1: function Remove(const StartIndex: Integer): Substring; overload;

#NameTypeDescription
1StartIndexInteger

Returns: Substring

Overload 2: function Remove(const StartIndex, Count: Integer): Substring; overload;

This string without Count characters at StartIndex, or without everything from StartIndex; this string is unchanged.

#NameDescription
1StartIndex

0-based; the range removed must lie inside the text, else ESubstringRangeError is raised.

Returns: Substring - At either end the part that remains, as Mid returns it; in the middle a new value.

Examples

Removing from the middle and from a position on.

uses Substr;

procedure Example;
begin
    Assert(Substring('abcdef').Remove(1, 2) = 'adef');
    Assert(Substring('abcdef').Remove(3) = 'abc');
end;