Insert other string

Syntax

s.insert(ss [from] [nc])

 

Parameters

s - str variable.

ss - insert this string. Can be string or numeric value.

from - where to insert. 0-based character index in s. Default: 0.

nc - number of characters to copy. Default: -1 (whole ss).

 

Remarks

Inserts string ss into s.

 

Example

str s = "My dog cat"
s.insert("and " 7)
 now s is "My dog and cat"