据我所知,巴西国家代码是 +55
但是这段代码
mobilePhoneNumber = "+32495665962";
isoCode = "BR";
phoneNumber = phoneNumberUtil.parse(mobilePhoneNumber, isoCode);
isValid = phoneNumberUtil.isValidNumber(phoneNumber);
phoneNumberType = phoneNumberUtil.getNumberType(phoneNumber);
System.out.println ("phoneNumber ----- > " + phoneNumber);
System.out.println ("isValid --------- > " + isValid);
System.out.println ("phoneNumberType - > " + phoneNumberType);
给我那个数字是有效的!
phoneNumber ----- > Country Code: 32 National Number: 495665962
isValid --------- > true
phoneNumberType - > MOBILE
最佳答案
defaultRegion
- region that we are expecting the number to be from. This is only used if the number being parsed is not written in international format. The country_code for the number in this case would be stored as that of the default region supplied. If the number is guaranteed to start with a '+' followed by the country calling code, then "ZZ" or null can be supplied.
您输入的是国际格式,所以没有使用这个参数。
为什么您希望图书馆将比利时的电话号码转换为巴西的电话号码?
关于java - com.google.i18n.phonenumbers 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44309997/