[Solved] Golang libphonenumber [closed]


The answer which I was looking is how to get the country code by passing the phone number only, this is the solution which is working perfectly.

num, err := phonenumbers.Parse("+123456789", "")

if err != nil {
    fmt.Println(err.Error())
}

regionNumber := phonenumbers.GetRegionCodeForNumber(num)
countryCode := phonenumbers.GetCountryCodeForRegion(regionNumber)
fmt.Println(countryCode)

Thank you Yacacov for the hint πŸ˜‰

solved Golang libphonenumber [closed]