Siebel eScript Language Reference > Siebel eScript Commands > Conversion or Casting Methods >

ToInt32() Method


This function converts its parameter to an integer in the range of -231 through 231 - 1.

Syntax

ToInt32(value)

Parameter
Description

value

The value to be converted to an integer

Returns

If the result is NaN, +0. If the result is +0 or -0, 0. If the result is POSITIVE_INFINITY, or NEGATIVE_INFINITY, Infinity. Otherwise, the integer part of the number, rounded toward 0.

Usage

This function converts value to an integer in the range of -231 through 231 - 1 (that is, -2,147,483,648 to 2,147,483,647). To use it without error, first pass value to isNaN() or to ToNumber().

To use isNan(), use a statement in the form

if (isNaN(value))
.
.   [error-handling statements];
.
else
   ToInt32(value);

Because ToInt32() truncates rather than rounds the value it is given, numbers are rounded toward 0. That is, -12.88 becomes -12; 12.88 becomes 12.

CAUTION:  The ToInt32() function is unique to Siebel eScript. Avoid using it in a script that may be used with a JavaScript interpreter that does not support it.

See Also

ToInteger() Method
ToNumber() Method
ToUint16() Method
ToUint32() Method

Siebel eScript Language Reference