format.PhoneNumberFormatter

Note:

The content in this help topic pertains to SuiteScript 2.0.

Object Description

The object that formats the phone 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

Phone Number Formatter Object Members

Since

2020.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 origNumberStr = "602547854ext.154";

var pnParser = format.getPhoneNumberParser({
    defaultCountry: format.Country.CZECH_REPUBLIC
});
var phoneNumber = pnParser.parse({
    number: origNumberStr
});

var pnFormatter = format.getPhoneNumberFormatter({});
var strNumber = pnFormatter.format({
    number: phoneNumber
});
// expected output (strNumber) is '+420 602 547 854 ext. 154'

...
// Add additional code 

          

Related Topics

General Notices