A golang library to deal with money and currency representation. Inspired by ruby money library.
$ go get github.com/joiggama/money
First, import the package adding:
import "github.com/joiggama/money"
Examples:
money.Format(10) // "$10.00"
money.Format(10, money.Options{"currency": "EUR"}) // "€10.00"
money.Format(10, money.Options{"with_cents": false}) // "$10"
money.Format(10, money.Options{"with_currency:" true }) // "$10.00 USD"
money.Format(10, money.Options{"with_symbol": false}) // "10.00"
money.Format(10, money.Options{"with_symbol_space":true}) // "$ 10.00"
money.Format(1000) // "$1,000.00"
money.Format(1000, money.Options{"with_thousands_separator": false}) // "$1000.00"
money.Format(10.00) // "$10.00"
money.Format(-10) // "-$10.00"
money.Format(-10.00) // "-$10.00"
For more detailed documentation refer to godoc
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request