MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / FormatCountFloat64

Function FormatCountFloat64

common/format.go:23–36  ·  view source on GitHub ↗
(count float64)

Source from the content-addressed store, hash-verified

21}
22
23func FormatCountFloat64(count float64) string {
24 switch {
25 case count < 1000:
26 return fmt.Sprintf("%.1f", count)
27 case count < 1000000:
28 return fmt.Sprintf("%.1fK", count/1000)
29 case count < 1000000000:
30 return fmt.Sprintf("%.1fM", count/1000000)
31 case count < 1000000000000:
32 return fmt.Sprintf("%.1fB", count/1000000000)
33 default:
34 return fmt.Sprintf("%.1fT", count/1000000000000)
35 }
36}
37
38func FormatTime(t int64) string {
39 if t < 1000 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected