string llInsertString( string dst, integer pos, string src );
Forced delay: 0.0 seconds. Energy: 10.0.
pos does not support negative indexes.
i.e. unlike other somewhat similar string functions such as llGetSubString and llDeleteSubString, you cannot use -1 for the counting with this function. You may use instead the function provided a bit further below.
Returns a string dst with src inserted starting at pos.
llInsertString("input", 2, "put out")// returns "input output"
This function will allow you to use a negative number as the position:
string insertString(string destination, integer position, string str) {
if (position < 0)
if ((position += llStringLength(destination)) < 0)
position = 0;
return llInsertString(destination, position, str);
}