mobi / telephone_number

Phone number validation for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How Get National Area Code

danieldocki opened this issue · comments

How can I get the national code of a phone and just the number without the national code?

irb(main):064> result = TelephoneNumber.parse("+5555999999999")
=>
#<TelephoneNumber::Number:0x000000013d4d5d30
...
irb(main):065> result.international_number
=> "+55 55 99999-9999"
irb(main):066> result.national_number
=> "(55) 99999-9999"
irb(main):067> result.national_area_code
(irb):67:in `<main>': undefined method `national_area_code' for an instance of TelephoneNumber::Number (NoMethodError)