Int

The Int function converts a float, string, or Boolean expression to an integer.

This function truncates any decimal fraction value associated with the number. For example, the value of Int(1234.67) is 1234.

Syntax

The Int function has the following syntax:

Integer = Int(Expression)

Parameters

The Int function has the following parameter.

Table 1. Int function parameters

Parameter

Format

Description

Expression

Float | String | Boolean

Expression to be converted.

Return value

The converted integer number.

Important: A float value converted to an int value is truncated not rounded.

Example

The following example shows how to convert float, string, and boolean expressions to an integer.

MyInt = Int(123.45);
Log(MyInt);
					
MyInt = Int(123.54);
Log(MyInt);
					
MyInt = Int("456");
Log(MyInt);
					
MyInt = Int(false);
Log(MyInt);

This example prints the following message to the policy log:

Parser Log: 123
Parser Log: 123
Parser Log: 456
Parser Log: 0