summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dustin/go-humanize/comma.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/dustin/go-humanize/comma.go')
-rw-r--r--vendor/github.com/dustin/go-humanize/comma.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/vendor/github.com/dustin/go-humanize/comma.go b/vendor/github.com/dustin/go-humanize/comma.go
index 13611aaab..520ae3e57 100644
--- a/vendor/github.com/dustin/go-humanize/comma.go
+++ b/vendor/github.com/dustin/go-humanize/comma.go
@@ -76,6 +76,14 @@ func Commaf(v float64) string {
return buf.String()
}
+// CommafWithDigits works like the Commaf but limits the resulting
+// string to the given number of decimal places.
+//
+// e.g. CommafWithDigits(834142.32, 1) -> 834,142.3
+func CommafWithDigits(f float64, decimals int) string {
+ return stripTrailingDigits(Commaf(f), decimals)
+}
+
// BigComma produces a string form of the given big.Int in base 10
// with commas after every three orders of magnitude.
func BigComma(b *big.Int) string {