Skip to content
Lists & Helpers listSlice

$listSlice — Keeps the items between two positions (both included)

Keeps the items between two positions (both included).

Syntax

$listSlice[list;from;(to);(separator)]

Parameters

  • list (text, required) — The items.
  • from (integer, required) — First position to keep (1 is the first item). Negative counts from the end.
  • to (integer, optional) — Last position to keep. Default: the end of the list.
  • separator (text, optional) — The text between two items. Default: ,. \n means a new line.

Return Value

  • string: empty when the range is outside the list.

Usage

$listSlice[a,b,c,d;2;3] → "b,c"
$listSlice[a,b,c,d;-2] → "c,d"

Example

$sendMessage[$listSlice[a,b,c,d;2;3]]

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.