Command Reference : String and Date Function Reference
Insert string into a string.
Syntax: @insert(str1, str2, n)
str1: string
str2: string
n: integer
Return: string
Inserts the string str2 into the string str1 at the position given by the integer n.
string sval1 = "I believe it can be done"
string sval2 = "not "
@insert("I believe it can be done", "not ", 16)
@insert(sval1, sval2, 16)
@insert(sval1, "not ", 16)
all return the string “I believe it cannot be done”.
If ALPHA1 is an alpha series,
alpha a1 = @insert(sval2, not ", 5)
creates an alpha series with the contents of ALPHA1 with the string “not ” at position 5, for each observation in the workfile sample.
alpha a2 = @insert(sval1, a1, ser1)
inserts SVAL1 into A1 using the integer positions given in the series SER1.
If SVEC1 is an svector,
svector s1 = @insert("(pretty please) ", svec1, 10)
inserts “(pretty please) ” into SVEC at position 10.
See also @replace, @instr and @mid.