Returns a new list containing a subset of the elements from the input list . The subset is specified using the arguments iLow and iHigh, which are inclusive indices. The indices are clamped to the respective ends of the list , if out of range. Note that the indices are 1-based.
subList ( list As List, _ iLow As Integer, _ iHigh As Integer ) As List
Argument | Type | Description |
---|---|---|
list | list | The input list |
iLow | integer | Index of the first item in the subset, inclusive (1-based). |
iHigh | integer | Index of the last item in the subset, inclusive (1-based). |
Intent >subList({:a, :b, :c, :d, :e, :f}, 2, 4) --> {:b, :c, :d}Here, the 2nd through 4th members of the list are returned.
Intent >subList({:a, :b, :c, :d, :e, :f}, -100, 4) --> {a, b, c, d}Here, the too-low iLow value is considered as a 1 for the purposes of the function evaluation.
Intent >subList({:a, :b, :c, :d, :e, :f}, 2, 100) --> {:b, :c, :d, :e, :f}Here, the too-high iHigh value is rounded down to the length of the list for the purposes of the function evaluation.
Intent >subList({:a, :b, :c, :d, :e, :f}, 6, 5) --> {}ihigh is less than ilow
Intent >subList({:a, :b, :c, :d, :e, :f}, -5, 10) --> {:a, :b, :c, :d, :e, :f}Indices beyond the length of the list do not actually index beyond the list.