|
overlay
>>-overlay(new-+---------------------------------------+-)-----><
+-,--+---+--+-------------------------+-+
+-n-+ +-,--+--------+--+------+-+
+-length-+ +-,pad-+
Returns a copy of the receiving string, which, starting at the
[n]
th character,
is overlaid with the string
[new]
,
padded or truncated to length
[length]
.
The overlay can extend beyond the end of the receiving 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 receiving string, padding is added
before the
[new]
string. The default
[pad]
character is a blank,
and the default value for
[n]
is
String class - overlay method
"abcdef"~overlay(" ",3) -> "ab def"
"abcdef"~overlay(".",3,2) -> "ab. ef"
"abcd"~overlay("qq") -> "qqcd"
"abcd"~overlay("qq",4) -> "abcqq"
"abc"~overlay("123",5,6,"+") -> "abc+123+++"
|