# remove

Definition: | sequence res = remove(sequence src, integer start, integer stop=start)
Description: | Remove an item, or a range of items from a sequence. src: the sequence to remove from. start: the start of the slice to remove. stop: the end of the slice to remove. Returns a sequence with the specified slice or item removed from it.
pwa/p2js: | Supported, although I strongly prefer the equivalent longhand code, which is faster anyway.
Comments: | This routine, defined in builtins\pseqc.e (an autoinclude), is simply `src[start..stop] = ""` and is provided only for compatibility with Euphoria, on which the above does not work. Note that if stop has (just) been calculated as length(src), then you are better off replacing the call to remove() with `src = src[1..start-1]` on both Phix and Euphoria, and consequently may no longer need to calculate or even declare the stop variable at all. There is also a map:remove() routine, and a JavaScript classList.remove, which are quite different.
Example: |
    s = remove("Johnn Doe", 4)              -- s is "John Doe"
    s = remove({1,2,3,3,4}, 4)              -- s is {1,2,3,4}
    s = remove("John Middle Doe", 6, 12)    -- s is "John Doe"
    s = remove({1,2,3,3,4,4}, 4, 5)         -- s is {1,2,3,4}