From cf24cfd453ad0e28173a603969ae85df522cbfa9 Mon Sep 17 00:00:00 2001 From: srowen Date: Thu, 5 Mar 2009 02:26:21 +0000 Subject: [PATCH] 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 --- .../google/zxing/client/result/TelResultParser.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/src/com/google/zxing/client/result/TelResultParser.java b/core/src/com/google/zxing/client/result/TelResultParser.java index d50147a11..d3f7775c5 100644 --- a/core/src/com/google/zxing/client/result/TelResultParser.java +++ b/core/src/com/google/zxing/client/result/TelResultParser.java @@ -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); } } \ No newline at end of file