Number functions
#
intValueThe intValue function returns integer when a decimal or whole value is given as input.
Syntax:
new NameSpace("number").intValue(
Number
numberValue);
Parameters:
Param | Data type | Description |
---|---|---|
numberValue | Number | Any number that needs to be converted to int. |
Returns: Number
Example:
int_val = new NameSpace("number").intValue(12.00);log int_val; //12
#
longValueThe longValue function will cast the given number to long value.
Syntax:
new NameSpace("number").longValue(
Number
numberValue);
Parameters:
Param | Data type | Description |
---|---|---|
numberValue | Number | Any number that needs to be converted to int. |
Returns: Number
Example:
long_val = new NameSpace("number").longValue(12456789123133455.00);log long_val; //12456789123133456
#
doubleValueThe doubleValue function will cast the given number to double value.
Syntax:
new NameSpace("number").doubleValue(
Number
numberValue);
Parameters:
Param | Data type | Description |
---|---|---|
numberValue | Number | Any number that needs to be converted to int. |
Returns: Number
Example:
double_val = new NameSpace("number").doubleValue(12);log double_val; //12.0
#
formatThe format function returns a formatted number when a decimal or whole value is given as input.
Syntax:
new NameSpace("number").format(
Number
numberValue);
Parameters:
Param | Data type | Description |
---|---|---|
numberValue | Number | Any number that needs to be formatted. |
Returns: Number
Example:
n = 23/45;format_val = new NameSpace("number").format(n);log format_val;