Closed ofir5300 closed 2 years ago
@ofir5300 Hi! Could you please attach an example when the loop appears?
I want to make a test with this case and fix it in a different way because your commit broken other use case (see issue https://github.com/dongri/phonenumber/issues/23)
Hey @4rakcheev,
It occured when I was querying US phone number and set landLine to true.
package alwasys returned Virgin Island
regardless the given phone, for the reason it is the last alphabetical country which matches this line of code
if r.MatchString(number) && len(number) == len(i.CountryCode)+l {
break
in L#100 is only terminating the inner loop, making the outer loop keeps on running and override the valid value that is found before. Returningi
immediately when found resolves this issue