Skip to content
Math & Text tonumber

$toNumber — Converts a text such as 416, ` 416 ` or "416" into a number.

Converts a text such as `416`, ` 416 ` or `"416"` into a number.

Syntax

$toNumber[value;(fallback)]

Parameters

  • value (text, required) — The text to convert. Spaces and surrounding quotes are ignored.
  • fallback (text, optional) — Returned when the value is not a number. Without it, the function raises an error.

Return Value

  • string.

Usage

$toNumber[ 416 ] → "416"
$toNumber[abc;0] → "0"

Example

$calculate[$toNumber[$getGuildVar[compteur]]+1]

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.