Introduction to `libphonenumber`

xiaoxiao2021-02-28  37

###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.**
转载请注明原文地址: https://www.6miu.com/read-2624963.html

最新回复(0)