Validates a U.S.A. phone number and formats it for display
200
This is an Openfaas function.
NOTES:
Validation Examples:
Sources:
Telephone Numbers In the United States (Wikipedia)
List_of_North_American_Numbering_Plan_area_codes (Wikipedia)
Formatting Examples:
| Input | Output | Valid Input |
|---|---|---|
| 717 123-4567 | (717) 123-4567 | true |
| 7171234567 | (717) 123-4567 | true |
| 1234567 | 123-4567 | true |
| 1-800-CALL-ME2 | 1-800-CAL-LME2 | true |
| 1800CALLME2 | 1-800-CAL-LME2 | true |
| 1800CALLME | 1800CALLME | false (Exchange Code [First digit less than 2]) |
| 123456 | 123456 | false (Only has 6 digits) |
Returns:
If phone number is valid, will be formatted phone number
If phone number is invalid, will be the phrase 'Invalid(): ' followed by the phone number as it was received by the function. will be the reason the phone number failed validation.
Usage:
Output:
Content type
Image
Digest
Size
24.6 MB
Last updated
over 8 years ago
docker pull mysmartbus/format_phonenumberdisplay