ee.List.slice
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trả về một phần của danh sách giữa chỉ mục bắt đầu (bao gồm) và chỉ mục kết thúc (không bao gồm). Giá trị âm cho start hoặc end đếm ngược từ cuối danh sách. Các giá trị lớn hơn kích thước của danh sách là hợp lệ nhưng sẽ bị cắt bớt thành kích thước của danh sách.
Cách sử dụng | Giá trị trả về |
---|
List.slice(start, end, step) | Danh sách |
Đối số | Loại | Thông tin chi tiết |
---|
this: list | Danh sách | |
start | Số nguyên | |
end | Số nguyên, mặc định: null | |
step | Số nguyên, mặc định: null | |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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 | |"]]