StringTools
Insert
insert a string into another
Calling Sequence
Parameters
Description
Examples
Insert( s, position, t )
s
-
string; Maple string
t
position
non-negative integer; position in s at which to insert t
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..length⁡s. 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 cat⁡t,s, while Insert( s, length( s ), t ) is equivalent to cat⁡s,t.
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.
with⁡StringTools:
Insert⁡abcd,0,=
=abcd
Insert⁡abcd,1,=
a=bcd
Insert⁡abcd,2,=
ab=cd
Insert⁡abcd,3,=
abc=d
Insert⁡abcd,4,=
abcd=
Insert⁡abcd,5,=
Error, (in StringTools:-Insert) string index `5' out of range
Insert⁡,0,Foo
Foo
seq⁡Insert⁡abc,n,,n=0..length⁡abc
abc
See Also
string
Download Help Document