mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Made a small change to the KDDI AU parsing code to handle pronunciation (aka Furigana) specifically.
git-svn-id: https://zxing.googlecode.com/svn/trunk@692 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
bbbef0d716
commit
cd0ff37fdb
|
@ -36,8 +36,4 @@ abstract class AbstractDoCoMoResultParser extends ResultParser {
|
|||
return matchSinglePrefixedField(prefix, rawText, ';', trim);
|
||||
}
|
||||
|
||||
static String[] maybeWrap(String value) {
|
||||
return value == null ? null : new String[] { value };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,13 +36,18 @@ final class AddressBookAUResultParser extends ResultParser {
|
|||
if (rawText == null || rawText.indexOf("MEMORY") < 0 || rawText.indexOf("\r\n") < 0) {
|
||||
return null;
|
||||
}
|
||||
String[] names = matchMultipleValuePrefix("NAME", 2, rawText, true);
|
||||
|
||||
// NAME1 and NAME2 have specific uses, namely written name and pronunciation, respectively.
|
||||
// Therefore we treat them specially instead of as an array of names.
|
||||
String name = matchSinglePrefixedField("NAME1:", rawText, '\r', true);
|
||||
String pronunciation = matchSinglePrefixedField("NAME2:", rawText, '\r', true);
|
||||
|
||||
String[] phoneNumbers = matchMultipleValuePrefix("TEL", 3, rawText, true);
|
||||
String[] emails = matchMultipleValuePrefix("MAIL", 3, rawText, true);
|
||||
String note = matchSinglePrefixedField("MEMORY:", rawText, '\r', false);
|
||||
String address = matchSinglePrefixedField("ADD:", rawText, '\r', true);
|
||||
return new AddressBookParsedResult(names, null, phoneNumbers, emails, note, address, null, null,
|
||||
null, null);
|
||||
return new AddressBookParsedResult(maybeWrap(name), pronunciation, phoneNumbers, emails, note,
|
||||
address, null, null, null, null);
|
||||
}
|
||||
|
||||
private static String[] matchMultipleValuePrefix(String prefix, int max, String rawText,
|
||||
|
|
|
@ -90,6 +90,10 @@ public abstract class ResultParser {
|
|||
}
|
||||
}
|
||||
|
||||
protected static String[] maybeWrap(String value) {
|
||||
return value == null ? null : new String[] { value };
|
||||
}
|
||||
|
||||
protected static String unescapeBackslash(String escaped) {
|
||||
if (escaped != null) {
|
||||
int backslash = escaped.indexOf((int) '\\');
|
||||
|
|
Loading…
Reference in a new issue