Wiki

Sample usage of the plugin:

function test_PhoneNumberUtil_format()
{
   var _swissNumberStr = '0446681800';
   var _pnUtil = plugins.argosPhoneNumber.newJSPhoneNumberUtil();
   var _pn = _pnUtil.parse(_swissNumberStr, 'CH');
   jsunit.assertNotNull(_pn);
   var _isValid = _pnUtil.isValidNumber(_pn); // returns true
   jsunit.assertTrue(_isValid);
   var _result = _pnUtil.format(_pn, ARGOS_PHONE_NUM_FORMAT.INTERNATIONAL);
   var _expect = '+41 44 668 18 00';
   jsunit.assertEquals(_expect,_result);

   _result = _pnUtil.format(_pn, ARGOS_PHONE_NUM_FORMAT.NATIONAL);
   _expect = '044 668 18 00';
   jsunit.assertEquals(_expect,_result);

   _result = _pnUtil.format(_pn, ARGOS_PHONE_NUM_FORMAT.E164);
   _expect = '+41446681800';
   jsunit.assertEquals(_expect,_result);

   _result = _pnUtil.formatOutOfCountryCallingNumber(_pn, 'US');
   _expect = '011 41 44 668 18 00';
   jsunit.assertEquals(_expect,_result);
}