3.2.40. OVERLAY(string1,string2[,[start][,[length][,padchar]]]) Returns a copy of string2, totally or partially overwritten by string1. If these are the only arguments, the overwriting starts at the first character in string2. If start is specified, the first character in string1 overwrites character number start in string2. Start must be a positive whole number, and defaults to 1, i.e. the first character of string1. If the start position is to the right of the end of string2, then string2 is padded at the right hand end to make it start-1 characters long, before string1 is added. If length is specified, then string2 will be stripped or padded at the right hand end to match the specified length. For padding (of both strings) padchar will be used, or <space> if padchar is unspecified. Length must be non-negative, and defaults to the length of string1. OVERLAY(‘NEW’, ‘old-value’) –> ‘NEW-value’ OVERLAY(‘NEW’, ‘old-value’, 3) –> ‘oldNEWlue’ OVERLAY(‘NEW’, ‘old-value’, 3, 5) –> ‘oldNEW e’ OVERLAY(‘NEW’, ‘old-value’, 3, 5), ‘*’) –> ‘oldNEW**e’ OVERLAY(‘NEW’, ‘old-value’, 3, 2) –> ‘oldNEalue’ OVERLAY(‘NEW’, ‘old-value’, 8) –> ‘old-valuNEW’ OVERLAY(‘NEW’, ‘old-value’, 10) –> ‘old-value NEW’ OVERLAY(‘NEW’, ‘old-value’, 8,, ‘*’) –> ‘old-value**NEW’ OVERLAY(‘NEW’, ‘old-value’, 8, 5, ‘*’) –> ‘old- value**NEW**’
PREV NEXT