Given a value, returns that value as a Number.
- value - the Number, Money, Percent, Enum, Boolean, or String value to be converted by the function.
- Return type:
number($100) returns 100.
number(string(base)) returns the original value of base.
If a Number value is passed, the same Number value will be returned.
If a Money value is passed, the amount will be returned as a Number.
If a Percent value is passed, the amount will be returned as a Number of subtype Decimal where 50% is equivalent to .5.
If a numeric scale Enum value is passed, the numeric value is returned as a Number.
If a Boolean value is passed, true will return the Number value 1, and false will return the Number value 0.
If a String value is passed, its constituent characters will be evaluated for compatibility with the Number data type. Characters which are compatible will be returned as a Number value. If two or more sets of compatible characters are separated by non-compatible characters (ex. "121yes121"), the compatible sets of characters will be returned as comma-separated values (ex. 121,121)
Unsupported data types
Unsupported data types return Null.