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

ToUint16() Method


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

Syntax

ToUint16(value)

Parameter
Description

value

The value to be converted

Returns

If the result is NaN, +0. If the result is +0 , 0. If the result is POSITIVE_INFINITY, it returns Infinity. Otherwise, it returns the unsigned (that is, absolute value of) integer part of the number, rounded toward 0.

Usage

This function converts value to an integer in the range of 0 to 216 - 1 (65,535). To use it without error, first pass value to isNaN() or to ToNumber().

To use toNumber(), use a statement in the following form:

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

Because ToUint16() truncates rather than rounds the value it is given, numbers are rounded toward 0. Therefore, 12.88 becomes 12.

CAUTION:  The ToUint16() 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
ToInteger() Method
ToNumber() Method
ToUint32() Method

Siebel eScript Language Reference