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

money notation

Open lfaoro opened this issue 2 years ago • 0 comments

In metric, you'd use M (mega) for million, G (giga) for billion and T (tera) for trillion.

In finance I have seen million, billion, and trillion abbreviated as M, B, and T respectively, although there doesn't seem to be a rule about it, only a best practice used in finance.

Would you allow me to add a pull request with this feature?

e.g.

humanize.Finance(2,475,260,494,216) outputs: $2.47T
humanize.Finance(2,475,260,494) outputs: $2.47B
humanize.Finance(2,475,260) outputs: $2.47M
humanize.Finance(2,475) outputs: $2.47K

NB: I added commas to make the numbers readable.

lfaoro avatar Aug 28 '21 12:08 lfaoro