Skip to content

v1.0.0

Choose a tag to compare

@mvfavila mvfavila released this 12 Apr 15:40

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 int64 centavos or strings.
  • Supports raw centavo strings like 100150, formatted strings like 1.001,50, and loose decimal strings like 1001,50.
  • Rejects negative values and unsupported input types.

Supported inputs

The public functions accept equivalent representations of the same value:

  • int64 values interpreted as centavos.
  • Raw numeric strings such as 199 or 7700022280.
  • Brazilian-formatted strings such as 1,99 or 77.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 int64 centavos.
  • The package is safe to use for non-negative values within the supported int64 range.
  • See the examples in README.md for common usage patterns.