1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-986 Dynamically display droplet attributes based on defined column names

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer
2020-10-13 12:42:18 -07:00
parent db997b9a73
commit 5522aa7a5d
3 changed files with 119 additions and 16 deletions

View File

@@ -77,12 +77,13 @@ func Truncate(src string, maxLen int, withEllipse bool) string {
return src
}
// Formats number as string with 1000 delimiters and, if necessary, rounds it to 2 decimals
// PrettyNumber formats number as string with 1000 delimiters and, if necessary, rounds it to 2 decimals
func PrettyNumber(number float64) string {
p := message.NewPrinter(language.English)
if number == math.Trunc(number) {
return p.Sprintf("%.0f", number)
} else {
return p.Sprintf("%.2f", number)
}
return p.Sprintf("%.2f", number)
}