Product SiteDocumentation Site

7.4.35. INSERT


>>-INSERT(new,target-------------------------------------------->

>--+---------------------------------------+--)----------------><
   +-,--+---+--+-------------------------+-+
        +-n-+  +-,--+--------+--+------+-+
                    +-length-+  +-,pad-+

Inserts the string new, padded or truncated to length length, into the string target after the nth character. The default value for n is 0, which means insertion before the beginning of the string. If specified, n and length must be positive whole numbers or zero. If n is greater than the length of the target string, the string new is padded at the beginning. The default value for length is the length of new. If length is less than the length of the string new, then INSERT truncates new to length length. The default pad character is a blank.
Here are some examples:

Example 7.48. Builtin function INSERT

INSERT(" ","abcdef",3)         ->    "abc def"
INSERT("123","abc",5,6)        ->    "abc  123   "
INSERT("123","abc",5,6,"+")    ->    "abc++123+++"
INSERT("123","abc")            ->    "123abc"
INSERT("123","abc", ,5,"-")    ->    "123--abc"