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


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


This operation is equivalent to:


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


Parameters


  • $source ... String expression into which $value is inserted.
  • $position ... Position at which $value is inserted. $position is one based.
  • $value ... String expression to insert.


Example:

Dim $s

$s = "This text"
$s = Insert($s, 6, "is a ")
' returns $s = "This is a text"