package compactnumber
Import Path
github.com/nkall/compactnumber (on go.dev)
Dependency Relation
imports 8 packages, and imported by one package
Involved Source Files
Package compactnumber allows for localized CLDR compact number formatting.
Code generated by https://github.com/nkall/compactnumber at 2019-10-20 13:43:16.072781 -0700 PDT m=+0.107571706. DO NOT EDIT.
Based on https://github.com/unicode-cldr/cldr-numbers-modern version 36
Do not edit this file manually! Instead, follow the "Generating Compact Forms" guide in the README.
models.go
Package-Level Type Names (total 3)
CompactType is an enum used to specify compaction settings.
func NewFormatter(lang string, compactType CompactType) Formatter
const Long
const None
const Short
Formatter is a struct containing a method to format an integer based on the specified language and compaction type.
Format takes in an integer and options and formats it according to the formatter's locale and compaction settings.
Note: this method truncates numbers and does not support fractions (e.g. 11.5M).
Documented in CLDR spec: http://www.unicode.org/reports/tr35/tr35-numbers.html#Compact_Number_Formats
*Formatter : FormatterAPI
func NewFormatter(lang string, compactType CompactType) Formatter
Package-Level Functions (only one)
NewFormatter creates a new formatter based on the specified language and compaction type.
Package-Level Constants (total 3)
Long-form compaction, e.g. 17 million.
No compaction, e.g. 17,000,000.
Short-form compaction, e.g. 17M.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |