toint()
Learn how to use the toint() function to convert the input value to an integer number representation.
Converts the input to an integer value (signed 32-bit) number representation.
Syntax
toint(value)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| value | scalar | ✔️ | The value to convert to an integer. |
Returns
If the conversion is successful, the result is an integer. Otherwise, the result is null. If the input includes a decimal value, the result truncate to only the integer portion.
Example
Convert string to integer
The following example converts a string to an integer and checks if the converted value is equal to a specific integer.
print toint("123") == 123
|project Integer = print_0
Output
| Integer |
|---|
| true |
Truncated integer
The following example inputs a decimal value and returns a truncated integer.
print toint(2.3)
|project Integer = print_0
Output
| Integer |
|---|
| 2 |
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.