mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Fix small display problem when extension starts with 9
git-svn-id: https://zxing.googlecode.com/svn/trunk@1608 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
493ddb3a13
commit
5abef2f3aa
|
@ -160,7 +160,7 @@ final class UPCEANExtensionSupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String parseExtension5String(String raw) {
|
private static String parseExtension5String(String raw) {
|
||||||
String currency = null;
|
String currency;
|
||||||
switch (raw.charAt(0)) {
|
switch (raw.charAt(0)) {
|
||||||
case '0':
|
case '0':
|
||||||
currency = "£";
|
currency = "£";
|
||||||
|
@ -169,18 +169,28 @@ final class UPCEANExtensionSupport {
|
||||||
currency = "$";
|
currency = "$";
|
||||||
break;
|
break;
|
||||||
case '9':
|
case '9':
|
||||||
if ("99991".equals(raw)) {
|
// Reference: http://www.jollytech.com
|
||||||
|
if ("90000".equals(raw)) {
|
||||||
|
// No suggested retail price
|
||||||
|
return null;
|
||||||
|
} else if ("99991".equals(raw)) {
|
||||||
|
// Complementary
|
||||||
return "0.00";
|
return "0.00";
|
||||||
} else if ("99990".equals(raw)) {
|
} else if ("99990".equals(raw)) {
|
||||||
return "Used";
|
return "Used";
|
||||||
}
|
}
|
||||||
|
// Otherwise... unknown currency?
|
||||||
|
currency = "";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
currency = "";
|
currency = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int rawAmount = Integer.parseInt(raw.substring(1));
|
int rawAmount = Integer.parseInt(raw.substring(1));
|
||||||
return currency + (rawAmount / 100) + '.' + (rawAmount % 100);
|
String unitsString = String.valueOf(rawAmount / 100);
|
||||||
|
int hundredths = rawAmount % 100;
|
||||||
|
String hundredthsString = hundredths < 10 ? "0" + hundredths : String.valueOf(hundredths);
|
||||||
|
return currency + unitsString + '.' + hundredthsString;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue