Closed bentcoder closed 2 months ago
The currency.Formatter has a Parse method you can use to get the amount and currency code. It's basically meant to be the opposite of Format().
It would not give you the symbol though, you would need custom logic for that.
Could you given an example of using the parse method for this use case please, even without the currency symbol. For example, if I have a value "0,49" EUR, passing this in to currency.NewAmount("0,49", "EUR") does not work; it's expecting "0.49". Can this be achieved by passing in localised formatting? It's what's being explained in this post https://stackoverflow.com/questions/45079074/parse-currency-float-string-to-float-type-based-on-locale-in-go
There's an example in GoDoc: https://pkg.go.dev/github.com/bojanz/currency#example-Formatter.Parse
Ah, classic RTFM! 🤦♂️ Thank you.
Hi,
Does this library extract and output the numeric bit for the given string representation? See dummy examples below.
Thanks