1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/docs/lib3x-slice.md

19 lines
570 B
Markdown
Raw Normal View History

2019-06-29 10:01:46 +08:00
# slice
Returns a list selected from `begin` to `end`, or to the `end` of the list (`end` not included).
2019-06-29 10:40:03 +08:00
**Since:** 2.0
2019-06-29 10:01:46 +08:00
## Parameters
- `lt` : The original list.
- `begin` : The beginning index, inclusive.
2019-06-29 10:02:47 +08:00
- `end` : The ending index, exclusive. If it's omitted, the list begins with the character at the specified `begin` and extends to the end of the original list.
2019-06-29 10:01:46 +08:00
## Examples
2022-06-06 13:11:46 +08:00
use <util/slice.scad>
2019-06-29 10:01:46 +08:00
2021-02-10 15:45:07 +08:00
assert(slice([for(c = "helloworld") c], 0, 5) == ["h", "e", "l", "l", "o"]);
assert(slice([for(c = "helloworld") c], 5) == ["w", "o", "r", "l", "d"]);