Source File
commaf.go
Belonging Package
github.com/dustin/go-humanize
//go:build go1.6// +build go1.6package humanizeimport ()// BigCommaf produces a string form of the given big.Float in base 10// with commas after every three orders of magnitude.func ( *big.Float) string {:= &bytes.Buffer{}if .Sign() < 0 {.Write([]byte{'-'}).Abs()}:= []byte{','}:= strings.Split(.Text('f', -1), "."):= 0if len([0])%3 != 0 {+= len([0]) % 3.WriteString([0][:]).Write()}for ; < len([0]); += 3 {.WriteString([0][ : +3]).Write()}.Truncate(.Len() - 1)if len() > 1 {.Write([]byte{'.'}).WriteString([1])}return .String()}
![]() |
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. |