From bec487babad3f037ef78ccd5b9a55120dbff9ce8 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 29 Jun 2019 10:01:46 +0800 Subject: [PATCH] add doc --- docs/lib2-slice.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 docs/lib2-slice.md diff --git a/docs/lib2-slice.md b/docs/lib2-slice.md new file mode 100644 index 00000000..d9cd36a9 --- /dev/null +++ b/docs/lib2-slice.md @@ -0,0 +1,18 @@ +# slice + +Returns a list selected from `begin` to `end`, or to the `end` of the list (`end` not included). + +**Since: ** 2.0 + +## Parameters + +- `lt` : The original list. +- `begin` : The beginning index, inclusive. +- `end` : The ending index, exclusive. If it's omitted, the substring begins with the character at the specified `begin` and extends to the end of the original string. + +## Examples + + include ; + + echo(slice([for(c = "helloworld") c], 0, 5)); // ECHO: ["h", "e", "l", "l", "o"] + echo(slice([for(c = "helloworld") c], 5)); // ECHO: ["w", "o", "r", "l", "d"]