strinsert

Inserts a string. (version 4.67 or later)

Format

strinsert <strvar> <index> <string>

Remarks

Inserts a specified instance of <string> at a specified <index> position(1-origin) in the string variable <strvar>.

Example

s='abc'
strinsert s 3 'XYZ'  ; 'abXYZc'
messagebox s s

s='abc'
strinsert s 1 'XYZ'  ; 'XYZabc'
messagebox s s

s='abc'
strinsert s -1 'XYZ'  ; Syntax error
messagebox s s

s='abc'
strinsert s 0 'XYZ'  ; Syntax error
messagebox s s

s='abc'
strinsert s 4 'XYZ'  ; 'abcXYZ'
messagebox s s

s='abc'
strinsert s 5 'XYZ'  ; Syntax error
messagebox s s

See also