ee.List.slice
Returns a portion of list between the start index, inclusive, and end index, exclusive. Negative values for start or end count backwards from the end of the list. Values greater than the size of the list are legal but are truncated to the size of list.
Usage | Returns |
---|
List.slice(start, end, step) | List |
Argument | Type | Details |
---|
this: list | List | |
start | Integer | |
end | Integer, default: null | |
step | Integer, default: null | |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-05 UTC.
[null,null,["Last updated 2024-06-05 UTC."],[[["This method returns a portion of a list, starting from the `start` index and ending before the `end` index."],["Negative indices for `start` or `end` are calculated from the end of the list."],["If `start` or `end` values exceed the list's size, they are adjusted to the list's boundaries."],["The optional `step` argument can be used to select elements at specific intervals, with a default of null implying a step of 1."]]],["The `List.slice` function extracts a sublist from a given list. It takes `start` and `end` indices (inclusive and exclusive, respectively) and an optional `step`. Negative indices count backward from the end. Out-of-bounds indices are adjusted to the list's boundaries. The function returns a new List. `end` and `step` default to null if not specified.\n"]]