Substring.Insert Method

Overload List

#SignatureDescription
1function Insert(const StartIndex: Integer; const S: Substring): Substring; overload;A copy of this string with S inserted at StartIndex; this string is unchanged.
2function Insert(const StartIndex: Integer; const S: string): Substring; overload;

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

A copy of this string with S inserted at StartIndex; this string is unchanged.

#NameDescription
1StartIndex

0-based, from 0 to Length; outside it ESubstringRangeError is raised.

2S

The text inserted, every text kind.

Returns: Substring - The new value.

Examples

Inserting a character.

uses Substr;

procedure Example;
begin
    Assert(Substring('ace').Insert(1, 'b') = 'abce');
end;

Overload 2: function Insert(const StartIndex: Integer; const S: string): Substring; overload;

#NameTypeDescription
1StartIndexInteger
2Sstring

Returns: Substring