Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Fortran

Idiom #291 Remove sublist

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

items = [items(:,i-1), items(j:)]

items needs to be an allocatable array. It is reallocated on assignment to a constructor containing the elements from the start of the array to i-1 and from j to the end.
items.removeRange(i, j);

New implementation...
< >
programming-idioms.org