.NET Phone Number Parsing Library

旧巷老猫 提交于 2019-12-20 15:22:10

问题


Does anyone know of a generic phone number parsing library for .NET? Ideally I'm looking for something similiar to the Ruby Phone library.


回答1:


You could start with Advanced Phone Number Type Implementation on CodeProject. At first glance, it seems that it may be lacking the internationalization pieces found in the Ruby library you referenced.

Of course, you could always start with an existing library and add on to it, and depending on the license of the original library, you might even choose to release your own that has exactly what you need.




回答2:


I would go with the C# port of the Google libphonenumber library.

https://bitbucket.org/pmezard/libphonenumber-csharp/wiki/Home




回答3:


I'd recommend going with libphonenumber from Google, here's a blog post on how to use libphonenumber.

Parsing numbers is as easy as installing the NuGet package and then doing this:

var util = PhoneNumberUtil.GetInstance();
var number = util.Parse("555-555-5555", "US");



回答4:


Have you considered taking the Ruby library you referenced and porting it to IronRuby, which runs on the .NET DLR? I haven't used IronRuby before, but since it's a .NET language, you may be able to simply port the code over and expose and strongly-typed interface that can be better consumed in VB.NET or C#.




回答5:


There's an alternative port of Google's libphonenumber on CodePlex. It doesn't seem as popular as the other one, but it looks like it's based on a newer version of the library and it looks like it's still being developed.



来源:https://stackoverflow.com/questions/3661620/net-phone-number-parsing-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!