Builtin

to_int

to_int(a) to_int(a, default_if_empty_string)

Returns the value of a converted to an integer.

If a is a string and is "" then default_if_empty_string, an int, is returned instead.

For bool, false=0 and true=1.

For times, returns number of microseconds since Jan 1 1970 UTC.

Examples

float
to_int(0.0)
0

str
to_int("42")
42

str with default
to_int("", 99.0)
99