Insert - Maple Help

StringTools

 Insert
 insert a string into another

 Calling Sequence Insert( s, position, t )

Parameters

 s - string; Maple string t - string; Maple string position - non-negative integer; position in s at which to insert t

Description

 • The Insert(s, position, t) command inserts a string t into the string s at position. The value of position must be an integer in the range $0..\mathrm{length}\left(s\right)$. Position $0$ is the position before the first character of s; position $1$ is the position after the first character of s; position $2$ is the position after the second character of s; and so on. Thus, Insert( s, 0, t ) is equivalent to $\mathrm{cat}\left(t,s\right)$, while Insert( s, length( s ), t ) is equivalent to $\mathrm{cat}\left(s,t\right)$.
 • All of the StringTools package commands treat strings as (null-terminated) sequences of $8$-bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Insert}\left("abcd",0,"="\right)$
 ${"=abcd"}$ (1)
 > $\mathrm{Insert}\left("abcd",1,"="\right)$
 ${"a=bcd"}$ (2)
 > $\mathrm{Insert}\left("abcd",2,"="\right)$
 ${"ab=cd"}$ (3)
 > $\mathrm{Insert}\left("abcd",3,"="\right)$
 ${"abc=d"}$ (4)
 > $\mathrm{Insert}\left("abcd",4,"="\right)$
 ${"abcd="}$ (5)
 > $\mathrm{Insert}\left("abcd",5,"="\right)$
 > $\mathrm{Insert}\left("",0,"Foo"\right)$
 ${"Foo"}$ (6)
 > $\left\{\mathrm{seq}\right\}\left(\mathrm{Insert}\left("abc",n,""\right),n=0..\mathrm{length}\left("abc"\right)\right)$
 $\left\{{"abc"}\right\}$ (7)