Cloud Software Group, Inc. EBX®
TIBCO EBX® Documentation
Navigation mode TIBCO EBX® Documentation

# Unit core.number

Script unit that provides number functions and constants.

Methods
function parse(value: string): decimal Parse the string representation of a number into a number.
function parseInt(value: string): decimal Parses the string argument as a signed decimal integer.

## parse

function parse(value: string): decimal

Parse the string representation of a number into a number. The string representation consists of an optional sign, '+' or '-', followed by a sequence of zero or more decimal digits ("the integer"), optionally followed by a fraction, optionally followed by an exponent. The fraction consists of a decimal point followed by zero or more decimal digits. The string must contain at least one digit in either the integer or the fraction. The number formed by the sign, the integer and the fraction is referred to as the significand. The exponent consists of the character 'e' or 'E' followed by one or more decimal digits. Example:

    uses core.number as nb;
    export procedure onAfterDelete()
    begin
      var number1 := nb.parse('123');
      var number2 := nb.parse('+123');
      var number3 := nb.parse('-123');
      var number4 := nb.parse('0.00123');
      var number5 := nb.parse('1.23E3');
      var number6 := nb.parse('1.23E+3');
      var number7 := nb.parse('1.23E-4');
    end

Parameters :

value: a String containing the number representation to be parsed

Return :

@return the number value represented by the argument, or null if the string does not contain a parsable number.

Can be used in: Script tasks, Table triggers, Function fields

## parseInt

function parseInt(value: string): decimal

Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign - to indicate a negative value or an ASCII plus sign +to indicate a positive value. Example:

    uses core.number as nb;
    export procedure onAfterDelete()
    begin
      var number1 := nb.parseInt('123');
      var number2 := nb.parseInt('+123');
      var number3 := nb.parseInt('-123');
    end

Parameters :

value: a String containing the int representation to be parsed

Return :

the integer value represented by the argument in decimal, or null if the string does not contain a parsable integer.

Can be used in: Script tasks, Table triggers, Function fields

TIBCO EBX® Documentation