Text.insert
insertindexthat
Group: Text
Documentation
Inserts text value at the specified index.
Arguments
- index: The position (0-based) in the text to inset text at. When the index is non-negative the text is inserted before the specified position. When the index is negative, then the characters are counted from the end of the text and the text is inserted after the specified position, i.e. -1 will insert the text after the last character.
Examples
Insert text at a specified index
"Hello World!".insert 0 " Cruel" == " CruelHello World!"
"Hello World!".insert 5 " Cruel" == "Hello Cruel World!"
"Hello World!".insert -1 " Cruel" == "Hello World! Cruel"
Remarks
What is a Character?
A character is defined as an Extended Grapheme Cluster, see Unicode Standard Annex 29. This is the smallest unit that still has semantic meaning in most text-processing applications.