Definition: | sequence res = replace(sequence src, object replacement, integer start, integer stop=start) |
Description: |
Replace a slice in a sequence.
src: the sequence in which replacement will be done. replacement: the item to replace the slice with. start: the start index of the slice to replace. stop: the end index of the slice to replace. Returns a sequence, with src[start..stop] replaced by replacement. |
Comments: |
This routine, defined in builtins\pseqc.e, is simply src[start..stop] = replacement; return src plus a bit of extra code for
when replacement is an atom, and is provided only for compatibility with OpenEuphoria.
|
Example: |
s = replace("John Middle Doe", "Smith", 6, 11) -- s is "John Smith Doe" s = replace({45.3, "John", 5, {10, 20}}, 25, 2, 3) -- s is {45.3, 25, {10, 20}} |