num

Prev Next

Function Names

num

Description

This function converts a variable to a plain numeral.

Vectorization: This function supports vectorization in the 1st function parameter. Instead of providing a single value, you can provide a set or even a nested set which contain multiple values. The function will then process every value and its return value contains a corresponding set containing all results.

Call as: function

Restrictions

Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter

Parameter count

1

Parameters

No.TypeDescription
1
input
valid types Value

Strings containing numbers (no text before numbers) are converted properly. Scientific notation is supported.
Numerals are passed through. If existing, the string context of the number will be discarded
Booleans are converted to 0 and 1
Dates are converted to a number in YYYYMMDD. Time will be added as fraction of 1, e.g. 0.5 for 12:00 noon.
Voids tranlate to 0
Use values inside sets to make use of vectorization.

Return value

TypeDescription
numeral
set
number

Contains resulting number. No string context of the number is preserved or included. If vectorization has been applied, a set containing results will be returned.

Examples

               echo( num( '1.2E+03' ) );
               echo( num( true ) );
               echo( num( 0123 ) );
               echo( num( date ( "05. Nov 2019 12:00" ) ) );

Output

1200
1
123
20191105.5
Try it yourself: Open LIB_Function_num.b4p in B4P_Examples.zip. Decompress before use.

See also

string conversion functions
date
pure date
date time
clean num
smart num