mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
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:
parent
ddffcde9f4
commit
cf24cfd453
|
@ -33,15 +33,12 @@ final class TelResultParser extends ResultParser {
|
|||
if (rawText == null || (!rawText.startsWith("tel:") && !rawText.startsWith("TEL:"))) {
|
||||
return null;
|
||||
}
|
||||
String telURI = rawText;
|
||||
// Normalize "TEL:" to "tel:"
|
||||
String telURI = rawText.startsWith("TEL:") ? "tel:" + rawText.substring(4) : rawText;
|
||||
// Drop tel, query portion
|
||||
int queryStart = rawText.indexOf('?', 4);
|
||||
if (queryStart < 0) {
|
||||
rawText = rawText.substring(4);
|
||||
} else {
|
||||
rawText = rawText.substring(4, queryStart);
|
||||
}
|
||||
return new TelParsedResult(rawText, telURI, null);
|
||||
String number = queryStart < 0 ? rawText.substring(4) : rawText.substring(4, queryStart);
|
||||
return new TelParsedResult(number, telURI, null);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue