Fixes #235 : Don't remove + in MECARD TEL: field

This commit is contained in:
Sean Owen 2014-10-05 14:34:58 +01:00
parent ba90a1c617
commit a2c11d45e6

View file

@ -92,7 +92,7 @@ public final class ContactInfoGenerator implements GeneratorSource {
output.append("MECARD:");
maybeAppendMECARD(output, "N", name.replace(",", ""));
maybeAppendMECARD(output, "ORG", company);
maybeAppendMECARD(output, "TEL", keepOnlyDigits(tel));
maybeAppendMECARD(output, "TEL", tel == null ? null : tel.replaceAll("[^0-9+]+", ""));
maybeAppendMECARD(output, "URL", url);
maybeAppendMECARD(output, "EMAIL", email);
maybeAppendMECARD(output, "ADR", buildAddress(address, address2));
@ -111,10 +111,6 @@ public final class ContactInfoGenerator implements GeneratorSource {
return output.toString();
}
private static String keepOnlyDigits(String s) {
return s == null ? null : s.replaceAll("[^0-9]+", "");
}
private static String buildAddress(String address, String address2) {
if (!address.isEmpty()) {
if (!address2.isEmpty()) {