cast.as_int

Supported in:
cast.as_int(string_to_cast)

Description

Converts a numeric string into an integer. Any function calls with values that cannot be cast return 0.

Param data types

STRING

Return type

FLOAT

Code samples

Example 1

Casting a non-numeric string returns 0.

cast.as_int("str") = 0
Example 2

Casting an empty string returns 0.

cast.as_int("") = 0
Example 3

Casting a valid numeric string returns an integer value.

cast.as_int("2.012345678") = 2