<分区>
如何通过使用此库在 golang 中传递数字来获取国家代码: https://godoc.org/github.com/nyaruka/phonenumbers ?
标签 go libphonenumber
<分区>
如何通过使用此库在 golang 中传递数字来获取国家代码: https://godoc.org/github.com/nyaruka/phonenumbers ?
最佳答案
我正在寻找的答案是如何通过仅传递电话号码来获取国家代码,这是完美运行的解决方案。
num, err := phonenumbers.Parse("+123456789", "")
if err != nil {
fmt.Println(err.Error())
}
regionNumber := phonenumbers.GetRegionCodeForNumber(num)
countryCode := phonenumbers.GetCountryCodeForRegion(regionNumber)
fmt.Println(countryCode)
谢谢 Yacacov 的提示 ;)
关于Golang libphonenumber,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55010028/