summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/price.vapi5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/price.vapi b/src/price.vapi
index d744ebc..60a4e78 100644
--- a/src/price.vapi
+++ b/src/price.vapi
@@ -10,7 +10,10 @@ public struct Price : int {
public static Price parse(string data) {
if("." in data) {
var parts = data.split(".");
- return int.parse(parts[0])*100 + int.parse(parts[1]);
+ if (parts[1].length <= 1)
+ return int.parse(parts[0])*100 + int.parse(parts[1])*10;
+ else
+ return int.parse(parts[0])*100 + int.parse(parts[1].substring(0,2));
} else {
return int.parse(data);
}