PhoneNumberParser 3.8.0
dotnet add package PhoneNumberParser --version 3.8.0
NuGet\Install-Package PhoneNumberParser -Version 3.8.0
<PackageReference Include="PhoneNumberParser" Version="3.8.0" />
paket add PhoneNumberParser --version 3.8.0
#r "nuget: PhoneNumberParser, 3.8.0"
// Install PhoneNumberParser as a Cake Addin #addin nuget:?package=PhoneNumberParser&version=3.8.0 // Install PhoneNumberParser as a Cake Tool #tool nuget:?package=PhoneNumberParser&version=3.8.0
Phone Number Parser
A library for parsing phone numbers, providing validity of phone numbers including national destination codes (aka area codes) and subscriber numbers (aka line numbers) based upon published numbering plans for each country. Additional attributes such as the kind of phone number (Mobile, Geographic or Non-Geographic) are also included, and all parsing is performed locally within the library using embedded in-memory data files.
using PhoneNumbers;
// Parsing a phone number is achieved via the `PhoneNumber.Parse` method (or alternatively via `PhoneNumber.TryParse`). Any formatting (e.g. spaces or hyphens) in the input string is ignored.
var phoneNumber = PhoneNumber.Parse("+441142726444"); // or Parse("01142726444", CountryInfo.UnitedKingdom) or Parse("01142726444", "GB")
phoneNumber.NationalDestinationCode; // 114 (aka area code)
phoneNumber.SubscriberNumber; // 2726444 (aka line number)
// Country specific information is accessible via the Country property, for example:
phoneNumber.Country.CallingCode; // 44
phoneNumber.Country.Iso3166Code; // GB
phoneNumber.Country.Name; // United Kingdom
phoneNumber.Country.TrunkPrefix; // 0
// There are 3 subclasses of PhoneNumber, the correct type to cast to can be determined by inspecting the phoneNumber.Kind property. Cast as appropriate to access additional properties.
var geographicPhoneNumber = (GeographicPhoneNumber)phoneNumber;
geographicPhoneNumber.GeographicArea; // Sheffield
// The phone number can be formatted in the following ways, the default format output can be round tripped via `PhoneNumber.Parse()` to easily support persistence and serialization use cases.
phoneNumber.ToString(); // +441142726444 (defaults to E.164 format)
phoneNumber.ToString("E.164"); // +441142726444 (E.164 format)
phoneNumber.ToString("E.123"); // +44 114 272 6444 (E.123 international format)
phoneNumber.ToString("N"); // (0114) 272 6444 (E.123 national notation format)
phoneNumber.ToString("RFC3966"); // tel:+44-114-272-644 (RFC3966 format)
Builds for:
- .NET 8.0
- .NET Standard 2.1 - supports .NET Core 3.0 or newer and .NET 5.0 or newer
- .NET Standard 2.0 - supports .NET Framework 4.6.2 or newer, however projects will need to be built with a minimum C# language version of 9.0 due to use of init only properties
Limitations
The library does not:
- Yet support every country
- Provide certainty that a phone number is assigned and in use
- Include the original carrier for mobile phone numbers due to number portability in most countries
- Support extension numbers, although they are ignored if specified when parsing a value in RFC3966 format or in the older German style
0234/123456-10
- Support alphabetic mnemonic system/alphabetic phone-words (e.g. 123-PHONEME)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- System.Memory (>= 4.6.0)
-
.NETStandard 2.1
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.8.0 | 1,892 | 11/28/2024 |
3.7.4 | 855 | 11/20/2024 |
3.7.3 | 1,320 | 11/4/2024 |
3.7.2 | 444 | 10/28/2024 |
3.7.1 | 281 | 10/23/2024 |
3.7.0 | 139 | 10/22/2024 |
3.6.0 | 1,961 | 9/23/2024 |
3.5.7 | 760 | 9/14/2024 |
3.5.6 | 678 | 9/12/2024 |
3.5.5 | 3,391 | 8/8/2024 |
3.5.4 | 556 | 8/5/2024 |
3.5.3 | 8,393 | 6/10/2024 |
3.5.2 | 2,165 | 5/29/2024 |
3.5.1 | 283,342 | 4/30/2024 |
3.5.0 | 1,760 | 4/15/2024 |
3.4.0 | 1,697 | 4/5/2024 |
3.3.2 | 1,177 | 3/20/2024 |
3.3.1 | 19,438 | 12/21/2023 |
3.3.0 | 16,589 | 9/22/2023 |
3.2.5 | 1,118 | 9/11/2023 |
3.2.4 | 376 | 9/5/2023 |
3.2.3 | 1,239 | 8/29/2023 |
3.2.2 | 1,824 | 7/20/2023 |
3.2.1 | 206 | 7/19/2023 |
3.2.0 | 2,116 | 6/2/2023 |
3.1.2 | 1,637 | 5/30/2023 |
3.1.1 | 147 | 5/30/2023 |
3.1.0 | 993 | 5/10/2023 |
3.0.0 | 1,132 | 4/26/2023 |
2.14.4 | 539 | 4/11/2023 |
2.14.3 | 260 | 4/9/2023 |
2.14.2 | 8,114 | 4/6/2023 |
2.14.1 | 279 | 4/4/2023 |
2.14.0 | 321 | 3/28/2023 |
2.13.3 | 242 | 3/24/2023 |
2.13.2 | 242 | 3/21/2023 |
2.13.1 | 342 | 3/17/2023 |
2.13.0 | 296 | 3/14/2023 |
2.12.1 | 1,002 | 3/4/2023 |
2.12.0 | 275 | 3/3/2023 |
2.11.0 | 499 | 2/24/2023 |
2.10.0 | 3,218 | 12/12/2022 |
2.9.1 | 692 | 10/26/2022 |
2.9.0 | 398 | 10/26/2022 |
2.8.0 | 394 | 10/6/2022 |
2.7.0 | 1,395 | 9/9/2022 |
2.6.0 | 411 | 9/7/2022 |
2.5.0 | 877 | 6/8/2022 |
2.4.1 | 884 | 4/20/2022 |
2.4.0 | 486 | 1/13/2022 |
2.3.0 | 293 | 12/31/2021 |
2.2.1 | 336 | 11/19/2021 |
2.2.0 | 310 | 11/11/2021 |
2.1.1 | 373 | 5/21/2021 |
2.1.0 | 368 | 4/20/2021 |
2.0.0 | 349 | 3/22/2021 |
1.8.0 | 451 | 2/5/2021 |
1.7.0 | 433 | 2/2/2021 |
1.6.0 | 458 | 1/25/2021 |
1.5.0 | 436 | 1/21/2021 |
1.4.0 | 397 | 1/19/2021 |
1.3.0 | 410 | 1/15/2021 |
1.2.0 | 399 | 1/14/2021 |
1.1.0 | 441 | 1/11/2021 |
1.0.1 | 515 | 1/2/2021 |
1.0.0 | 436 | 12/31/2020 |
See https://github.com/TrevorPilley/phone-number-parser/releases/tag/3.8.0 for a summary of changes made in this release of the package.