Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java com.google.i18n.phonenumbers Bug?_Java_Internationalization - Fatal编程技术网

Java com.google.i18n.phonenumbers Bug?

Java com.google.i18n.phonenumbers Bug?,java,internationalization,Java,Internationalization,据我所知,巴西国家代码为+55 但是这段代码 mobilePhoneNumber = "+32495665962"; isoCode = "BR"; phoneNumber = phoneNumberUtil.parse(mobilePhoneNumber, isoCode); isValid = phoneNumberUtil.isValidNumber(phoneNumber); phoneNu

据我所知,巴西国家代码为+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
-我们希望号码来自的地区仅当解析的数字不是以国际格式写入时才使用此选项。在这种情况下,号码的国家/地区代码将存储为提供的默认地区代码。如果保证号码以“+”开头,后跟国家/地区呼叫代码,则可以提供“ZZ”或null

您的输入是国际格式的,因此不使用此参数


你为什么希望图书馆把比利时的电话号码转换成巴西的

libphonenumber
isValidNumber(…)
如果该号码在任何地方都有效,则将返回true。例如,您输入的是有效的比利时号码。我相信你用错了。对于要执行的操作,请使用
isValidNumberForRegion(Phonenumber.Phonenumber,String regionCode)