format.NumberFormatter

Object Description

The object that formats number to string.

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/format/i18n Module

Methods and Properties

N/format/i18n Module Members

Since

2019.2

Syntax

Important:

The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see N/format/i18n Module Script Samples.

            // Add additional code
...
var numFormatter1 = format.getNumberFormatter(); // no parameter given so the default number formatter object returned

var numFormatter2 = format.getNumberFormatter({
    groupSeparator: " ",
    decimalSeparator: ",", 
    precision: 2, 
    negativeNumberFormat: format.NegativeNumberFormat.MINUS
});

var number1 = numFormatter1.format({
    number: 12.53
}); // number1 is '12.53'

var number2 = numFormatter2.format({
    number: 12845.22
}); // number2 is '12 845,22'
...
// Add additional code 

          

Related Topics

N/format/i18n Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices