Insert

Top  Previous  Next

sub Insert(sValue As String, ByRef sSource As String, iPosition As Integer)

 

Inserts sValue into sSource at the position iPosition. The first character of sSource has the index 1.

 

It's similar to:

sSource = Left(sSource, iPosition-1) + sValue + Mid(sSource, iPosition, MaxInt)

 

Parameters

 

sValue ... String expression that should be inserted.
sSource ... String expression into which sValue should be inserted.
iPosition ... Position where sValue should be inserted. iPosition is one based.

 

Example:

Dim s

 

= "This text"

Insert("is a ", s, 6)

' returns s = "This is a text"




Translate document: