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

ToInteger() Method

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





The value to be converted to an integer


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


This function converts value to an integer in the range of -215 to 215 - 1 (that is, -32,768 to 32,767). To use it without error, first pass value to isNaN() or to ToNumber().

To use toNumber(), use a statement of the form:

var x;
x = toNumber(
(if x == 'NaN')
.   [error -handling statements];

Because ToInteger() 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 ToInteger() function is unique to Siebel eScript. Before using it, confirm that the JavaScript interpreter that will run the script supports Siebel eScript functions. Avoid using this function in a script that may be used with a JavaScript interpreter that does not support it.

See Also

Math.round() Method
toFixed() Method
ToNumber() Method
ToString() Method
ToUint16() Method
ToUint32() Method

Siebel eScript Language Reference