num

Prev Next

Function Names

num

Description

This function converts a variable to a plain numeral.

Call as: function

Restrictions

Indirect parameter passing is disabled

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
Parameter sets are not accepted
Dates are converted to a number in YYYYMMDD. Time will be added as fraction of 1, e.g. 0.5 for 12:00 noon.

Return value

TypeDescription
numeral number

Contains resulting number. No string context of the number is preserved or included.

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