Contents | Index | < Browse | Browse >
OVERLAY(<new string>, <old string>,[<startpos>], [<length>],[<padchar>])
returns a string
Replaces the characters of <old string> starting at position <startpos>
with the characters of <new string>. The default starting position is the
beginning of <old string>.
If <length> is not specified, all of the characters from <new string> will
be overlaid on <old string>. If a <length> is specified, then <new string>
will either be truncated to that length or expanded to <length> using
<padchar> to fill out the string.
The default pad character is a blank.
Examples:
say overlay('12', 'abcdefg', 3, 4, '*') >>> ab12**g
say overlay('abc', '12345678', 4, 2) >>> 123ab678
say overlay( 'think of it',,
'the less I concentrate the more certain I am', 12)
>>> the less I think of it the more certain I am
Also see
Note that the third example above uses the comma continuation character
to turn two lines of text into one program line.
Next: REVERSE() | Prev: LENGTH() | Contents: String functions