splice
| Definition: | sequence res = splice(sequence src, object what, integer index) |
| Description: |
Inserts an object as a new slice in a sequence at a given position.
src: the sequence to insert into what : the object/slice to insert index : the position where it should be inserted Returns a sequence, with what inserted into src.
|
| pwa/p2js: | Supported, although I genuinely prefer the longhand code, which is faster anyway. |
| Comments: |
This routine, defined in builtins\pseqc.e (an auto-include), is simply
return src[1..index-1] & what & src[index..length(src)]
and is only provided for compatibility with Euphoria. |
| Example: |
s = splice("John Doe", " Middle", 5) -- s is "John Middle Doe"
s = splice({10,30,40}, 20, 2) -- s is {10,20,30,40}
|