Faker v0.10.0 Faker.Phone.EnUs View Source
This follows the rules outlined in the North American Numbering Plan at https://en.wikipedia.org/wiki/North_American_Numbering_Plan.
The NANP number format may be summarized in the notation NPA-NXX-xxxx:
The allowed ranges for NPA (area code) are: [2–9] for the first digit, and [0-9] for the second and third digits. The NANP is not assigning area codes with 9 as the second digit.
The allowed ranges for NXX (central office/exchange) are: [2–9] for the first digit, and [0–9] for both the second and third digits (however, in geographic area codes the third digit of the exchange cannot be 1 if the second digit is also 1).
The allowed ranges for xxxx (subscriber number) are [0–9] for each of the four digits.
Link to this section Summary
Functions
Returns a random area code
Returns a random exchange code
Returns a random extension n digits long
Returns a random US phone number
Returns a random subscriber number n digits long
Link to this section Functions
Returns a random area code
Returns a random exchange code
Returns a random extension n digits long
Returns a random US phone number
Possible returned formats:
(123) 456-7890 123/456-7890 123-456-7890 123.456.7890 1234567890
subscriber_number(pos_integer()) :: String.t()
Returns a random subscriber number n digits long