Skip to content
Math & Text findNumbers

$findNumbers

$findNumbers reads a text and returns every number it contains, in the order they appear.

Syntax

$findNumbers[text;(separator)]

Parameters

Parameter Description
text Required. The text to read.
separator Optional. Text placed between two numbers, , by default.

Return Value

  • The numbers, joined by the separator. An empty text when there is none.
  • A number may have a decimal part written with a dot (3.5). A - right before a number makes it negative, unless it follows a digit or a letter: 7-2 gives 7 and 2, x -2 gives -2.

Examples

$findNumbers[Paid -3.5 then 12 (ref 7-2)]

Result: -3.5, 12, 7, 2

$var[first;$advancedTextSplit[$findNumbers[$message;|];|;1]]
First number of your message: $var[first]

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.