/** * 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, "")); }
/** * 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); }