insertString
insertString ( source : string , what : string , where : integer ) : string
Parameter | Type | Description | |
---|---|---|---|
source | string | -> | String in which to insert the other string |
what | string | -> | String to insert |
where | integer | -> | Where to insert |
Result | string | <- | Resulting 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"