Skip to main content
Version: Next

insertString

insertString ( source : string , what : string , where : integer ) : string

ParameterTypeDescription
sourcestringString in which to insert the other string
whatstringString to insert
whereintegerWhere to insert
ResultstringResulting string

Description

The insertString command inserts a string into source and returns the resulting string. The command inserts the string what before the character at position where.

If what is an empty string (""), insertString returns source unchanged.

If where is greater than the length of source, then what is appended to source. If where is less than one (1), then what is inserted before source.

insertString is different from changeString in that it inserts characters instead of overwriting them.

Example

 var vtResult : string
vtResult = insertString("The tree"," green",4) // vtResult gets "The green tree"
vtResult = insertString("Shut","o",3) // vtResult gets "Shout"
vtResult = insertString("Indention","ta",6) // vtResult gets "Indentation"

See also

changeString
deleteString
replaceString