int

Static int 

Source
pub static int: IntInternalType
Expand description

Converts a boolean, string, or float to its integer representation. When an array of values is passed in, then an int array of the same length is returned.

Examples

print(int('10')); // 10
print(int(10.31)); // 10
print(int(-10)); // -10
print(int(true)); // 1
print(int(false)); // 0
print(int([false, true, '10.3', 9.8])); // [0, 1, 10, 9]
print(int(Infinity)); // Infinity
print(int('-Infinity')); // -Infinity

Overloads

n value to parse

radix? the radix to convert to (default: 10)


ns values to parse