Logo

Programming-Idioms

Delete all the elements from index i (included) to index j (excluded) from the list items.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
items.removeRange(i, j);
items = [items(:,i-1), items(j:)]
copy(items[i:], items[j:])
for k, n := len(items)-j+i, len(items); k < n; k++ {
	items[k] = nil
}
items = items[:len(items)-j+i]
items = append(items[:i], items[j:]...)
import "slices"
items = slices.Delete(items, i, j)
import java.util.ArrayList;
for(int index = i; index < j; index++) {
	items.remove(index);
}
for index := j-1 downto i do
  items.delete(index);
splice @items, $i, ($j - $i);
items[i:j] = []
del items[i:j]
items.slice!(i...j)
items.drain(i..j)