String.Insert

Syntax

Insert(Source: String; Start: Integer; Value: String): String;

Parameters

Source - source string.

Start - substring insertion position.

Value - substring.

Description

The Insert method inserts a substring passed as the Value input parameter into the specified place of the source string passed as the Source parameter, starting from the position specified in the Start parameter in the source string.

If the value of the Start parameter exceeds the length of the source string (the Source parameter), the substring is inserted into the end of the source string.

Example

Sub Main;

Var

s, s1, s2, s3: String;

Begin

s := "abcdef";

s1 := "X";

s2 := String.Insert(s, 2, s1);

s3 := String.Insert(s, 20, s1);

End Sub Main;

After executing the example the "s2" variable will contain the abXcdef value, and the "s3" variable will contain the abcdefX value.

See also:

String