$tonumber

$tonumber

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$tonumber

Converts a value into its numeric equivalent.

Syntax

$tonumber(expression,decimals)

Parameters

expressionAny value, or an expression that yields any value.
decimalsA number specifying the number of decimal places required in the converted value. Decimals can be negative.

Return Value

Number equivalent of expression.

Comments

Use $tonumber to obtain the numeric equivalent of expression. If decimals is negative, the implicit number of decimal places in expression is used.

Example

$tonumber(1.273,2)

Evaluates to 1.27.

$tonumber(16/6,3)

Evaluates to 2.667.

$tonumber("2345",2)

Evaluates to 2345.00.

$tonumber("Smith",5)

Evaluates to 0.00000 (and produces an error).

$tonumber("1.2"*1.20,-1)

Evaluates to 1.44.

See Also

$money
$round
$toalpha
$tocharacter
About Functional Expressions
Decimals and Rounding
Decimals in Functional Expressions
Number Literals

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish