From 80e1f41596ca9955b432addbf01b913d864aa7c0 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Tue, 26 Aug 2025 11:25:59 +0200 Subject: Stricter ING decimal parsing --- lib/ingcsv.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ingcsv.ml b/lib/ingcsv.ml index edb8aaa..f9cd95e 100644 --- a/lib/ingcsv.ml +++ b/lib/ingcsv.ml @@ -9,9 +9,9 @@ module Cents = struct type t = Z.t let of_string s = - (* TODO: consider being more bitchy here *) - String.lsplit2_exn s ~on:',' |> Tuple2.map ~f:Z.of_string - |> fun (high, low) -> Z.((high * ~$100) + low) + let high, low = String.lsplit2_exn s ~on:',' in + assert (String.length low = 2); + Z.((of_string high * ~$100) + of_string low) end module Transaction_type = struct -- cgit v1.2.3