Modules

filter

 

Objects/Functions

module (N/format/i18n)

SuiteScript 2.0

PhoneNumberParser.parse(options)

{PhoneNumberParser}.parse({number: {string*}})

N/format/i18n Module
PhoneNumberParser.parse()
Method Description: Parses the string containing the phone number and returns the phone number object. If the input string contains the country code, it parses the given phone number. If the input string does not contain the country code, the country given to PhoneNumberParser as constructor parameter is used.
Returns: Object
Supported Script Types: Client and server-side scripts For more information, see SuiteScript 2.0 Script Types.
Governance: None
Module: N/format/i18n Module
Parent Object: format.PhoneNumberParser
Methods and Properties: Phone Number Parser Object Members
Since: 2020.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=PhoneNumberParser.parse(options)

Example:

// Code Example 1
// Add additional code
//...
require(['N/format/i18n'],
function(format) {
var pnParser = format.getPhoneNumberParser({
defaultCountry: format.Country.CZECH_REPUBLIC
});
var phoneNumber = pnParser.parse({
number: "602547854ext.154"
});
log.debug(phoneNumber.countryCode);
log.debug(phoneNumber.extension);
log.debug(phoneNumber.nationalNumber);
log.debug(phoneNumber.numberOfLeadingZeros);
log.debug(phoneNumber.carrierCode);
log.debug(phoneNumber.rawInput);
});
//...
// Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_158626797748.html