All Projects → dongri → phonenumber

dongri / phonenumber

Licence: MIT license
With a given country and phone number, validate and format the MOBILE phone number to E.164 standard

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to phonenumber

Telephone number
Phone number validation for Ruby
Stars: ✭ 262 (+142.59%)
Mutual labels:  phone, number
yup-phone
☎️ Adds a phone number validation check to yup validator using google-libphonenumber
Stars: ✭ 219 (+102.78%)
Mutual labels:  phone, number
Libphonenumber Js
A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
Stars: ✭ 2,233 (+1967.59%)
Mutual labels:  phone, number
PhoneNumberKit
Android Kotlin library to parse and format international phone numbers. Country code picker.
Stars: ✭ 124 (+14.81%)
Mutual labels:  phone, number
Vue Phone Number Input
A phone number input made with Vue JS (format & valid phone number)
Stars: ✭ 407 (+276.85%)
Mutual labels:  phone, number
React Phone Input 2
📞 Highly customizable phone input component with auto formatting
Stars: ✭ 446 (+312.96%)
Mutual labels:  phone, number
React Phone Number Input
React component for international phone number input
Stars: ✭ 725 (+571.3%)
Mutual labels:  phone, number
Camera2
Camera App write with api 2
Stars: ✭ 156 (+44.44%)
Mutual labels:  phone
Koler
Just a phone app
Stars: ✭ 201 (+86.11%)
Mutual labels:  phone
Arcoreinsideouttrackinggearvr
Inside Out Positional Tracking (6DoF) for GearVR/Cardboard/Daydream using ARCore v1.6.0
Stars: ✭ 150 (+38.89%)
Mutual labels:  phone
Twilio
Twilio notifications channel for Laravel
Stars: ✭ 141 (+30.56%)
Mutual labels:  phone
Mobile Select Area
手机联动选择地区
Stars: ✭ 157 (+45.37%)
Mutual labels:  phone
Payphone
notes and code for my payphone project
Stars: ✭ 206 (+90.74%)
Mutual labels:  phone
Plexus
Remove the fear of Android app compatibility on de-Googled devices.
Stars: ✭ 152 (+40.74%)
Mutual labels:  phone
Rooms
Ephemeral conference rooms powered by Twilio and Google App Engine
Stars: ✭ 234 (+116.67%)
Mutual labels:  phone
Ngx Webcam
A simple Angular webcam component / pure & minimal, no flash-fallback
Stars: ✭ 148 (+37.04%)
Mutual labels:  phone
Camera2
Camera App write with api 2
Stars: ✭ 222 (+105.56%)
Mutual labels:  phone
Moriarty Project
This tool gives information about the phone number that you entered.
Stars: ✭ 223 (+106.48%)
Mutual labels:  phone
Device Detector Js
A precise user agent parser and device detector written in TypeScript
Stars: ✭ 193 (+78.7%)
Mutual labels:  phone
Socialtextview
A simple custom Android TextView that highlights content such as Mention, Hashtag, Phone, Email and Url.
Stars: ✭ 195 (+80.56%)
Mutual labels:  phone

phonenumber

Coverage Run Tests

Description

golang port of node-phone

phonenumber is used to normalize the mobile phone or landline number into a E.164 format.

The common problem is user normally input the phone number in this way:

09061354467 or
090-6135-4467 or
(090) 6135-4467 or
819061354467 or
+819061354467 or
81(90) 6135-4467 or
+81(90) 6135-4467 or ...

What we want is always:

819061354467

Installation

Run the following command to install the package:

go get github.com/dongri/phonenumber

Usage

Clearing format

In this case landline numbers will be an invalid result:

import "github.com/dongri/phonenumber"

number := phonenumber.Parse("090-6135-4467", "JP")
fmt.Println(number)
// Output: 819061354467

In this case you can format numbers included landline numbers:

import "github.com/dongri/phonenumber"

number := phonenumber.ParseWithLandLine("+371 65 552-336", "LV")
fmt.Println(number)
// Output: 37165552336

Get country for number

import "github.com/dongri/phonenumber"

// Get country with mobile and landline numbers
// Let's try to get country for Latvian landline number
includeLandLine := true
country := phonenumber.GetISO3166ByNumber("37165552336", includeLandLine)
fmt.Println(country.CountryName)
// Output: Latvia

// Get country with mobile numbers only
includeLandLine = false
country := phonenumber.GetISO3166ByNumber("37165552336", includeLandLine)
fmt.Println(country.CountryName)
// Output:

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].