ee.List.slice
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Zwraca część listy między indeksem początkowym (włącznie) a indeksem końcowym (wyłącznie). Ujemne wartości początku lub końca liczą się wstecz od końca listy. Wartości większe niż rozmiar listy są prawidłowe, ale są obcinane do rozmiaru listy.
Wykorzystanie | Zwroty |
---|
List.slice(start, end, step) | Lista |
Argument | Typ | Szczegóły |
---|
to: list | Lista | |
start | Liczba całkowita | |
end | Liczba całkowita, domyślnie: null | |
step | Liczba całkowita, domyślnie: null | |
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003eThis method returns a portion of a list, starting from the \u003ccode\u003estart\u003c/code\u003e index and ending before the \u003ccode\u003eend\u003c/code\u003e index.\u003c/p\u003e\n"],["\u003cp\u003eNegative indices for \u003ccode\u003estart\u003c/code\u003e or \u003ccode\u003eend\u003c/code\u003e are calculated from the end of the list.\u003c/p\u003e\n"],["\u003cp\u003eIf \u003ccode\u003estart\u003c/code\u003e or \u003ccode\u003eend\u003c/code\u003e values exceed the list's size, they are adjusted to the list's boundaries.\u003c/p\u003e\n"],["\u003cp\u003eThe optional \u003ccode\u003estep\u003c/code\u003e argument can be used to select elements at specific intervals, with a default of null implying a step of 1.\u003c/p\u003e\n"]]],["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"],null,["# ee.List.slice\n\nReturns 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.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------|---------|\n| List.slice`(start, `*end* `, `*step*`)` | List |\n\n| Argument | Type | Details |\n|--------------|------------------------|---------|\n| this: `list` | List | |\n| `start` | Integer | |\n| `end` | Integer, default: null | |\n| `step` | Integer, default: null | |"]]