MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / FormatCountInt64

Function FormatCountInt64

common/format.go:8–21  ·  view source on GitHub ↗
(count int64)

Source from the content-addressed store, hash-verified

6)
7
8func FormatCountInt64(count int64) string {
9 switch {
10 case count < 1000:
11 return strconv.FormatInt(count, 10)
12 case count < 1000000:
13 return fmt.Sprintf("%.1fK", float64(count)/1000)
14 case count < 1000000000:
15 return fmt.Sprintf("%.1fM", float64(count)/1000000)
16 case count < 1000000000000:
17 return fmt.Sprintf("%.1fB", float64(count)/1000000000)
18 default:
19 return fmt.Sprintf("%.1fT", float64(count)/1000000000000)
20 }
21}
22
23func FormatCountFloat64(count float64) string {
24 switch {

Callers 1

generateTopNFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected