v1.0.0
dinheiro v1.0.0
Release date: 2026-04-12
This is the first stable release of dinheiro, a Go library for handling Brazilian monetary values.
Highlights
- Formats monetary values as Brazilian currency strings with dot thousand separators and a comma decimal separator.
- Produces written-out Brazilian Portuguese descriptions for the same values.
- Accepts monetary inputs as either
int64centavos or strings. - Supports raw centavo strings like
100150, formatted strings like1.001,50, and loose decimal strings like1001,50. - Rejects negative values and unsupported input types.
Supported inputs
The public functions accept equivalent representations of the same value:
int64values interpreted as centavos.- Raw numeric strings such as
199or7700022280. - Brazilian-formatted strings such as
1,99or77.000.222,80. - Loose string values that only add the comma decimal separator, such as
1001,50.
Public API
ToText(value any) (string, error)ToTextDescription(value any) (string, error)
Notes
- Values are represented internally as
int64centavos. - The package is safe to use for non-negative values within the supported
int64range. - See the examples in README.md for common usage patterns.