Core Function StrInsert
From Sputnik Wiki
StrInsert( <expression>, <index>, <expression2> )
Contents |
Description
Insert a string at a given index of another string and return the new string
Parameters
expression
The source string.
index
Index position to place the second string within the first (First char is 0).
expression2
The string to place within the first.
Return Value
The new string.
Remarks
If index is below zero it will be set to 0.
If index is higher than destination length it will be appended to end of the destination string.
Example
$var = "I am a string"; $var = StrInsert($var, 3, "TEST"); MsgBox($var);
Can also be done like so
// Inserts CatDog into position 10 of the string // since the string is only 5 chars long spaces // will be automatically inserted to fill in the gaps $Test = "Hello"; $Test[10] = "CatDog"; println("Value is: '$Test'");