Insert

Top  Previous  Next

Sub Insert($source As String, $position As Integer, $value As String) As String

 

Inserts $value into $source at the position $position. The first character of $source has the index 1.

 

It's similar to:

$source = Left($source, $position-1) + $value + Mid($source, $position, MaxInt)

 

Parameters

 

$source ... String expression into which $value should be inserted.
$position ... Position where $value should be inserted. $position is one based.
$value ... String expression that should be inserted.

 

Example:

Dim $s

 

$s = "This text"

Insert($s, 6, "is a ")

' returns $s = "This is a text"