Normalize TEL: to tel: to make sure it works with Android

git-svn-id: https://zxing.googlecode.com/svn/trunk@870 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-03-05 02:26:21 +00:00
parent ddffcde9f4
commit cf24cfd453

View file

@ -33,15 +33,12 @@ final class TelResultParser extends ResultParser {
if (rawText == null || (!rawText.startsWith("tel:") && !rawText.startsWith("TEL:"))) { if (rawText == null || (!rawText.startsWith("tel:") && !rawText.startsWith("TEL:"))) {
return null; return null;
} }
String telURI = rawText; // Normalize "TEL:" to "tel:"
String telURI = rawText.startsWith("TEL:") ? "tel:" + rawText.substring(4) : rawText;
// Drop tel, query portion // Drop tel, query portion
int queryStart = rawText.indexOf('?', 4); int queryStart = rawText.indexOf('?', 4);
if (queryStart < 0) { String number = queryStart < 0 ? rawText.substring(4) : rawText.substring(4, queryStart);
rawText = rawText.substring(4); return new TelParsedResult(number, telURI, null);
} else {
rawText = rawText.substring(4, queryStart);
}
return new TelParsedResult(rawText, telURI, null);
} }
} }