.NET Phone Number Parsing Library

前端 未结 5 886
余生分开走
余生分开走 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: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");
    

提交回复
热议问题