summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorMiguel Mota <miguelmota2@gmail.com>2018-12-25 22:11:59 -0800
committerMiguel Mota <miguelmota2@gmail.com>2018-12-25 22:11:59 -0800
commitbd58b112f1d22667956ecdc3f78b50742ef17485 (patch)
tree641b8411953f7105912aa7ac6183637a72502c1b /pkg
parent70e18090a9814853cf3af2caa724588372f7c0c3 (diff)
portfolio percentages
Diffstat (limited to 'pkg')
-rw-r--r--pkg/humanize/humanize.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/humanize/humanize.go b/pkg/humanize/humanize.go
index 3ef17c5..8daf95d 100644
--- a/pkg/humanize/humanize.go
+++ b/pkg/humanize/humanize.go
@@ -4,6 +4,9 @@ import (
"bytes"
"strconv"
"strings"
+
+ "golang.org/x/text/language"
+ "golang.org/x/text/message"
)
// Commaf produces a string form of the given number in base 10 with
@@ -38,3 +41,9 @@ func Commaf(v float64) string {
}
return buf.String()
}
+
+// Commaf2 ...
+func Commaf2(v float64) string {
+ p := message.NewPrinter(language.English)
+ return p.Sprintf("%.2f", v)
+}