Product SiteDocumentation Site

7.4.45. OVERLAY


>>-OVERLAY(new,target------------------------------------------->

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

Returns the string target, which, starting at the nth character, is overlaid with the string new, padded or truncated to length length. The overlay may extend beyond the end of the original target string. If you specify length, it must be a positive whole number or zero. The default value for length is the length of new. If n is greater than the length of the target string, the string new is padded at the beginning. The default pad character is a blank, and the default value for n is 1. If you specify n, it must be a positive whole number.
Here are some examples:

Example 7.59. Builtin function OVERLAY

OVERLAY(" ","abcdef",3)         ->    "ab def"
OVERLAY(".","abcdef",3,2)       ->    "ab. ef"
OVERLAY("qq","abcd")            ->    "qqcd"
OVERLAY("qq","abcd",4)          ->    "abcqq"
OVERLAY("123","abc",5,6,"+")    ->    "abc+123+++"