Introduction to `libphonenumber`

###Introduction to `libphonenumber`
-----


####libphonenumber
`libphonenumber` is Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers.


Maven: http://maven.ibiblio.org/maven2/com/googlecode/libphonenumber/libphonenumber/
Github: https://github.com/googlei18n/libphonenumber


**Author:** Maintained by **Google Internationalization** (https://developers.google.com/international) Multiple contributors on Github  --(https://github.com/googlei18n/libphonenumber/blob/master/CONTRIBUTORS)
**License: Apache License 2.0**


##### Features
- **Parsing, formatting, and validating** phone numbers for all countries/regions of the world.
- **getNumberType** - gets the type of the number based on the number itself; able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP, Personal Numbers, UAN, Pager, and Voicemail (whenever feasible).
- **isNumberMatch** - gets a confidence level on whether two numbers could be the same.
- **getExampleNumber / getExampleNumberForType** - provide valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed.
- **isPossibleNumber** - quickly guesses whether a number is a possible phone number by using only the length information, much faster than a full validation.
- **isValidNumber** - full validation of a phone number for a region using length and prefix information.
- **AsYouTypeFormatter** - formats phone numbers on-the-fly when users enter each digit.
- **findNumbers** - finds numbers in text.
- **PhoneNumberOfflineGeocoder** - provides geographical information related to a phone number.
- **PhoneNumberToCarrierMapper** - provides carrier information related to a phone number.
- **PhoneNumberToTimeZonesMapper** - provides timezone information related to a phone number.


The last 3 are relatively new features that're not implemented in C# yet.




#### Third-party Ports (libphonenumber-csharp)
`libphonenumber` has some third-party extensions in other programming languages, including C#, Objective-C, PHP, Python, Ruby, etc. All these extensions have been acknowledged by Google, and listed on the github webpage.


![Alt text](./libphonenumber.jpg)


As is shown in the screenshot, `libphonenumber-csharp` is one of them. It is rewritten in C# from Java, mostly unchanged. It's homepage is: https://bitbucket.org/pmezard/libphonenumber-csharp/wiki/Home


**Author:** Mainly **Patrick Mezard** and **Tom Clegg** (totally 69 contributors on Github up to 1st Jan 2018)
**License: Apache License 2.0**




##### Features
- **Parsing/formatting/validating** phone numbers for all countries/regions of the world.
- **GetNumberType** - gets the type of the number based on the number itself; able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP and Personal Numbers (whenever feasible).
- **IsNumberMatch** - gets a confidence level on whether two numbers could be the same.
- **GetExampleNumber / GetExampleNumberByType** - provides valid example numbers for 218 countries/regions, with the option of specifying which type of example phone number is needed.
- **IsPossibleNumber** - quickly guessing whether a number is a possible phonenumber by using only the length information, much faster than a full validation.
- **AsYouTypeFormatter** - formats phone numbers on-the-fly when users enter each digit.
- **FindNumbers** - finds numbers in text input




####Differences between `libphonenumber(Java)` and `libphonenumber-csharp`
* Folder structures are different. Have an insight of the Java and C# repositories: 


**Java**
![Alt text](./2018-02-01_11-31-26.png)


**C#**
![Alt text](./2018-02-01_11-32-14.png)


Either of the two directories has files that don't exist in the other directory.


####Similarities between `libphonenumber(Java)` and `libphonenumber-csharp`
Some files with the same names in Java and C# have same functions and implementations. 
e.g. 
`PhoneNumber.java` & `PhoneNumber.cs`
`PhoneNumberUtil.java` & `PhoneNumberUtil.cs`
`AsYouTypeFormatter.java` & `AsYouTypeFormatter.cs`


However, there're also some files with the same name but their contents are not completely similar.
e.g.
`MetadataManager.java` & `MetadataManager.cs`


**Although `libphonenumber-csharp` only imitates a part of code from `libphonenumber`, the two projects have considerable distinctions on project structure and functionalities.**
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值