MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / formatUsageQty

Function formatUsageQty

internal/estimate/estimator.go:775–790  ·  view source on GitHub ↗

formatUsageQty formats a usage quantity for display (e.g. 1000000 → "1,000,000").

(qty float64)

Source from the content-addressed store, hash-verified

773
774// formatUsageQty formats a usage quantity for display (e.g. 1000000 → "1,000,000").
775func formatUsageQty(qty float64) string {
776 s := strconv.FormatFloat(qty, 'f', 0, 64)
777 // Insert thousand separators.
778 n := len(s)
779 if n <= 3 {
780 return s
781 }
782 var out []byte
783 for i, c := range s {
784 if i > 0 && (n-i)%3 == 0 {
785 out = append(out, ',')
786 }
787 out = append(out, byte(c))
788 }
789 return string(out)
790}

Callers 2

PrintResultsFunction · 0.85
renderTotalsTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected