mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Issue 1184 treat semicolon field separator as newline
git-svn-id: https://zxing.googlecode.com/svn/trunk@2214 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
240424bec0
commit
5287b54bb2
|
@ -41,6 +41,7 @@ public final class VCardResultParser extends ResultParser {
|
||||||
private static final Pattern VCARD_ESCAPES = Pattern.compile("\\\\([,;\\\\])");
|
private static final Pattern VCARD_ESCAPES = Pattern.compile("\\\\([,;\\\\])");
|
||||||
private static final Pattern EQUALS = Pattern.compile("=");
|
private static final Pattern EQUALS = Pattern.compile("=");
|
||||||
private static final Pattern SEMICOLON = Pattern.compile(";");
|
private static final Pattern SEMICOLON = Pattern.compile(";");
|
||||||
|
private static final Pattern SEMICOLONS = Pattern.compile(";+");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressBookParsedResult parse(Result result) {
|
public AddressBookParsedResult parse(Result result) {
|
||||||
|
@ -64,7 +65,10 @@ public final class VCardResultParser extends ResultParser {
|
||||||
List<List<String>> addresses = matchVCardPrefixedField("ADR", rawText, true);
|
List<List<String>> addresses = matchVCardPrefixedField("ADR", rawText, true);
|
||||||
if (addresses != null) {
|
if (addresses != null) {
|
||||||
for (List<String> list : addresses) {
|
for (List<String> list : addresses) {
|
||||||
list.set(0, list.get(0));
|
String adr = list.get(0);
|
||||||
|
// Semicolon separators -- just make them a newline
|
||||||
|
adr = SEMICOLONS.matcher(adr).replaceAll("\n").trim();
|
||||||
|
list.set(0, adr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<String> org = matchSingleVCardPrefixedField("ORG", rawText, true);
|
List<String> org = matchSingleVCardPrefixedField("ORG", rawText, true);
|
||||||
|
|
Loading…
Reference in a new issue