19 lines
540 B
Java
19 lines
540 B
Java
package com.drinkool.utils;
|
|
|
|
import com.google.i18n.phonenumbers.*;
|
|
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
|
|
|
|
public class PhoneValidator {
|
|
private static final PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
|
|
|
|
public static boolean isValidInternationalPhone(String phone) {
|
|
try {
|
|
PhoneNumber numberProto = phoneUtil.parse(phone, "VN");
|
|
|
|
return phoneUtil.isValidNumber(numberProto);
|
|
} catch (NumberParseException e) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|