Something went wrong. Try again.
Convert CSV banking statements to hledger journals
Something went wrong. Try again.
12345678910111213141516171819202122const std = @import("std");const Writer = std.Io.Writer;
pub const Currency = enum { eur, usd,
/// Exact match: the cell is read as written (M1-CSV-020). pub fn parse(cell: []const u8) ?Currency { if (std.mem.eql(u8, cell, "USD")) return .usd; if (std.mem.eql(u8, cell, "EUR")) return .eur; return null; }
pub fn format(self: Currency, writer: *Writer) Writer.Error!void { switch (self) { .usd => try writer.print("USD", .{}), .eur => try writer.print("EUR", .{}), } }};