From f28df3148bea1738b8bf67906a53f32aca14bf20 Mon Sep 17 00:00:00 2001 From: riCo Date: Sat, 19 Apr 2025 11:09:31 +0200 Subject: [PATCH] amount can now be interpreted even with a dot --- money-money-girocode/ScanController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/money-money-girocode/ScanController.swift b/money-money-girocode/ScanController.swift index c2cd344..0a737e3 100644 --- a/money-money-girocode/ScanController.swift +++ b/money-money-girocode/ScanController.swift @@ -137,7 +137,10 @@ extension GiroCode { static func parseAmount(s: String?) -> Double? { if let amountStr = s, amountStr.count > 4 { let index = amountStr.index(amountStr.startIndex, offsetBy: 3) - return Double(String(amountStr[index...]).trimmingCharacters(in: .whitespacesAndNewlines)) + let numberString = String(amountStr[index...]) + .trimmingCharacters(in: .whitespacesAndNewlines) + .replacingOccurrences(of: ",", with: ".") //now also works with dot in amountString + return Double(numberString) } else { return nil }