Template:Strloc insert/doc

The string-inserter Template:Strloc_insert inserts a string into another string at a specified location, or appends it at the end.

Usage

 * {&#123;Strloc insert| |strloc=| }}

Returns string1 with string2 inserted at location strloc=n, where n=1 denotes the start of the string (prepending). If strloc <= 0 then string2 is appended at the end of string1. The parameter strloc can be a math formula, such as: strloc=-2, or strloc=abs(-2*5)+6.

Examples
The following show various uses:
 * {&#123;Strloc insert|abcdef|strloc=4|ZZZ}}&rarr;
 * {&#123;Strloc insert|123456|strloc=1|++}}&rarr;
 * {&#123;Strloc insert|Abcd|strloc=0 |EFG}}&rarr;
 * &rarr;
 * &rarr;
 * Note, the example wikilinking "Out of Africa" inserted "&lt;/i>" as end-italics, but with strloc=17+20 to skip farther in the " " wikilink string.
 * &rarr;
 * In the example with "Cosmos (book)" the number for strloc was set by finding "(" in the title. If there had been no "(" then the result would append "&lt;/i>" at the end of the title.

Limitations
The text at the end (after string2) is subject to the limitations of Template:Str_right. Spaces around the inserted string are limited to 1 space, before or after:
 * &rarr;

Spaces beyond the inserted string might be encoded as "&amp;#32;" rather than being real spaces.