Although phone numbers are considered to be a string value in the Microformats specifications, some parsers do treat them as a data type and perform different levels of validation. To allow the test-runner to test parsers equally the following method canonicalise and compare phone numbers.
This code takes a string phone number and provides a canonicalised version.
This code takes the two phone numbers and compares canonicalised version of them to see if they are equal.
01273 715100 01273715100 +44 1273 715100 +441273715100 800-555-1212 8005551212 800.555.1212 8005551212 (800) 555-1212 8005551212 800-555-1212x1234 80055512121234 800-555-1212 ext. 1234 80055512121234 work 1-(800) 555.1212 #1234 180055512121234
Some rights reserved