go-money icon indicating copy to clipboard operation
go-money copied to clipboard

digit group separation and decimal split separator

Open trobert2 opened this issue 4 years ago • 4 comments

This is a great package. Would you mind updating the documentation on how we can use different formats used around the world, like other European countries, not to mention India where they separate digit groups differently?

I would mainly like to get

1.244,90 €

instead of

€1,244.90

trobert2 avatar Aug 02 '19 07:08 trobert2

Hey @trobert2!

You can always add new custom currency using AddCurrency method. It accepts:

	Fraction int
	Grapheme string
	Template string
	Decimal  string
	Thousand string

to make your custom currency display in whatever matter you want. There is a big list of currencies already there. https://github.com/Rhymond/go-money/blob/master/currency.go If you can't find yours please let me know and we can update the list.

Rhymond avatar Nov 12 '19 13:11 Rhymond

Juste in case, you didn't get the notification ;)

nmaupu avatar Jun 27 '20 16:06 nmaupu

Hi Rhymon, It is quite clear that one can add its own flavor of grouping signs, but the grouping of currency in the European Union is done with , as decimal separator and . as thousand separator. Anything else is just wrong. The advantage of your package is that one does not have to modify for every country but can rely on correctness of the code base. Please change accordingly. Cheers Joerg

codezork avatar Oct 03 '20 20:10 codezork

I forgot: the template is "1 $" in Europe.

codezork avatar Oct 03 '20 20:10 codezork