Example #1
0
        /**
         * Given a phone number, returns the phone number with all characters, other than numbers, stripped
         * @param {String} phone the phone number to normalize
         * @return {String} the normalized phone number
         * @static
         */
        static JsString normalizePhoneNumber(JsString phone)
        {
            phone = phone.toString();
            JsRegExp regex = new JsRegExp("[^\\d]", "g");

            return(phone.replace(regex, ""));
        }
Example #2
0
 /**
  * Given a valid address, if it is a phone number will return the normalized phone number. See {@link Att.Provider#normalizePhoneNumber}
  * Otherwise, returns the address as it is.
  * @param address {String} the address to normalize.
  * @returns {String} the normalize phone number or address.
  * @static
  */
 static JsString normalizeAddress(JsString address)
 {
     address = address.toString();
     if (_Provider.isValidPhoneNumber(address))
     {
         address = _Provider.normalizePhoneNumber(address);
     }
     return(address);
 }