mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
Fixes #235 : Don't remove + in MECARD TEL: field
This commit is contained in:
parent
ba90a1c617
commit
a2c11d45e6
|
@ -92,7 +92,7 @@ public final class ContactInfoGenerator implements GeneratorSource {
|
||||||
output.append("MECARD:");
|
output.append("MECARD:");
|
||||||
maybeAppendMECARD(output, "N", name.replace(",", ""));
|
maybeAppendMECARD(output, "N", name.replace(",", ""));
|
||||||
maybeAppendMECARD(output, "ORG", company);
|
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, "URL", url);
|
||||||
maybeAppendMECARD(output, "EMAIL", email);
|
maybeAppendMECARD(output, "EMAIL", email);
|
||||||
maybeAppendMECARD(output, "ADR", buildAddress(address, address2));
|
maybeAppendMECARD(output, "ADR", buildAddress(address, address2));
|
||||||
|
@ -110,11 +110,7 @@ public final class ContactInfoGenerator implements GeneratorSource {
|
||||||
output.append(';');
|
output.append(';');
|
||||||
return output.toString();
|
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) {
|
private static String buildAddress(String address, String address2) {
|
||||||
if (!address.isEmpty()) {
|
if (!address.isEmpty()) {
|
||||||
if (!address2.isEmpty()) {
|
if (!address2.isEmpty()) {
|
||||||
|
|
Loading…
Reference in a new issue