@Test public void testFormatWhatsapp2Simple() { String ipl = "WhatsApp Chat - Fulano - 5511998765555"; assertEquals("+55 11 99876-5555", service.format(ipl)); }
@Override public String format(String hit) { hit = extractNotAllowedChars(hit); PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber phoneNumber = phoneUtil.parse(hit, "BR"); hit = phoneUtil.format(phoneNumber, PhoneNumberFormat.INTERNATIONAL); } catch (NumberParseException e) { } return hit; }
TelefoneRegexValidatorService extends BasicAbstractRegexValidatorService { @Override public String format(String hit) { hit = extractNotAllowedChars(hit); PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber phoneNumber = phoneUtil.parse(hit, "BR"); hit = phoneUtil.format(phoneNumber, PhoneNumberFormat.INTERNATIONAL); } catch (NumberParseException e) { } return hit; } }
TelefoneRegexValidatorService extends BasicAbstractRegexValidatorService { @Override public String format(String hit) { hit = extractNotAllowedChars(hit); PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber phoneNumber = phoneUtil.parse(hit, "BR"); hit = phoneUtil.format(phoneNumber, PhoneNumberFormat.INTERNATIONAL); } catch (NumberParseException e) { } return hit; }  }
TelefoneRegexValidatorService extends BasicAbstractRegexValidatorService { @Override public String format(String hit) { hit = extractNotAllowedChars(hit); PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber phoneNumber = phoneUtil.parse(hit, "BR"); hit = phoneUtil.format(phoneNumber, PhoneNumberFormat.INTERNATIONAL); } catch (NumberParseException e) { } return hit; }  @Override boolean validate(String hit); @Override String format(String hit); @Override List<String> getRegexNames(); @Override void init(File confDir); }
TelefoneRegexValidatorService extends BasicAbstractRegexValidatorService { @Override public String format(String hit) { hit = extractNotAllowedChars(hit); PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber phoneNumber = phoneUtil.parse(hit, "BR"); hit = phoneUtil.format(phoneNumber, PhoneNumberFormat.INTERNATIONAL); } catch (NumberParseException e) { } return hit; }  @Override boolean validate(String hit); @Override String format(String hit); @Override List<String> getRegexNames(); @Override void init(File confDir);  }