Siebel eScript Language Reference > Methods Reference > Conversion Methods >

Convert Value to Integer Method


The Convert Value to Integer method converts the value that the value argument contains to an integer in the range of negative 215 through 215 minus 1. The equivalent nonexponential range is negative 32,768 through 32,767. It returns a value depending on which of the following values the value argument contains:

  • NaN. It returns the following value:

    +0

  • +0. It returns the following value:

    -0

  • POSITIVE_INFINITY or NEGATIVE_INFINITY. It returns the result.
  • A number. It rounds the integer part of this number toward zero, and then returns the integer.

This method is unique to Siebel eScript. For more information, see Make Sure the JavaScript Interpreter Can Run a Function.

This method uses the same arguments as the Convert Value to Integer 32 method. For more information, see Table 95.

Format

ToInteger(value)

Usage

To avoid an error, you must first pass the value that the value argument contains to the Is NaN method or to the Convert Value to Number method. To use the Convert Value to Number method, you can include a statement that uses the following format:

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

The Convert Value to Integer method truncates rather than rounds the value it receives. It rounds numbers toward 0. For example, it rounds negative 12.88 to negative 12. It rounds 12.88 to 12.

Related Topics

For more information, see the following topics:

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.