.NET Phone Number Parsing Library

前端 未结 5 891
余生分开走
余生分开走 2021-02-06 08:01

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

相关标签:
5条回答
  • 2021-02-06 08:22

    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.

    0 讨论(0)
  • 2021-02-06 08:34

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

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

    0 讨论(0)
  • 2021-02-06 08:35

    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");
    
    0 讨论(0)
  • 2021-02-06 08:35

    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#.

    0 讨论(0)
  • 2021-02-06 08:37

    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.

    0 讨论(0)
提交回复
热议问题