Skip to main content

Number functions

intValue#

The intValue function returns integer when a decimal or whole value is given as input.

Syntax:

new NameSpace("number").intValue(Number numberValue);

Parameters:

ParamData typeDescription
numberValueNumberAny number that needs to be converted to int.

Returns: Number

Example:

int_val = new NameSpace("number").intValue(12.00);log int_val; //12

longValue#

The longValue function will cast the given number to long value.

Syntax:

new NameSpace("number").longValue(Number numberValue);

Parameters:

ParamData typeDescription
numberValueNumberAny number that needs to be converted to int.

Returns: Number

Example:

long_val = new NameSpace("number").longValue(12456789123133455.00);log long_val; //12456789123133456

doubleValue#

The doubleValue function will cast the given number to double value.

Syntax:

new NameSpace("number").doubleValue(Number numberValue);

Parameters:

ParamData typeDescription
numberValueNumberAny number that needs to be converted to int.

Returns: Number

Example:

double_val = new NameSpace("number").doubleValue(12);log double_val; //12.0

format#

The format function returns a formatted number when a decimal or whole value is given as input.

Syntax:

new NameSpace("number").format(Number numberValue);

Parameters:

ParamData typeDescription
numberValueNumberAny number that needs to be formatted.

Returns: Number

Example:

n = 23/45;format_val = new NameSpace("number").format(n);log format_val;