Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 861 Bytes

phone_number.md

File metadata and controls

38 lines (27 loc) · 861 Bytes

Faker::PhoneNumber

Phone numbers may be in any of the following formats:

  • 333-333-3333
  • (333) 333-3333
  • 1-333-333-3333
  • 333.333.3333
  • 333-333-3333
  • 333-333-3333 x3333
  • (333) 333-3333 x3333
  • 1-333-333-3333 x3333
  • 333.333.3333 x3333

(Don't let the example output below fool you - any format can be returned at random.)

Faker::PhoneNumber.phone_number #=> "397.693.1309"

Faker::PhoneNumber.cell_phone #=> "(186)285-7925"

# NOTE NOTE NOTE NOTE
# For the 'US only' methods below, first you must do the following:
Faker::Config.locale = 'en-US'

# US only
Faker::PhoneNumber.area_code #=> "201"

# US only
Faker::PhoneNumber.exchange_code #=> "208"

# Optional parameter: length=4
Faker::PhoneNumber.subscriber_number #=> "3873"

Faker::PhoneNumber.subscriber_number(2) #=> "39"

Faker::PhoneNumber.extension #=> "3764"