Java 将国际电话号码转换为本地电话号码

Java 将国际电话号码转换为本地电话号码,java,android,phone-number,libphonenumber,Java,Android,Phone Number,Libphonenumber,我正在尝试使用libphonenumbergooglelibrary从 从国际到地方 所代表的国际数字为:“+97239658320” 当地号码(在以色列这里是):“039658320” 然而,在“电话”中,结果是: Country Code: 972 National Number: 39658320 (without the leading zero) 如何正确转换它?查看的快速示例表明,解析后您应该: { country_code: 972 national_number: 39658

我正在尝试使用
libphonenumber
googlelibrary从 从国际到地方

所代表的国际数字为:“+97239658320”

当地号码(在以色列这里是):“039658320”

然而,在“电话”中,结果是:

Country Code: 972 National Number: 39658320 (without the leading zero)

如何正确转换它?

查看的快速示例表明,解析后您应该:

{
country_code: 972
national_number: 39658320
}
要获得您想要的格式,您应该使用format
NATIONAL

phoneUtil.format(phone, PhoneNumberFormat.NATIONAL)

要去掉电话号码分隔符,请查看

谢谢!结果现在是:03-965-8320。我将手动删除连字符:D
phoneUtil.format(phone, PhoneNumberFormat.NATIONAL)