Skip to content
Lists & Helpers listIndexOf

$listIndexOf — Position of an item in a list (1 is the first), or 0 when it is absent

Position of an item in a list (1 is the first), or 0 when it is absent.

Syntax

$listIndexOf[list;item;(separator)]

Parameters

  • list (text, required) — The items.
  • item (text, required) — The item to find.
  • separator (text, optional) — The text between two items. Default: ,. \n means a new line.

Return Value

  • number.

Usage

$listIndexOf[a,b,c;b] → "2"
$listIndexOf[a,b;z] → "0"

Example

$sendMessage[$listIndexOf[a,b,c;b]]

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.