MCPcopy Create free account
hub / github.com/microsoft/typescript-go / trimTrailingZeros

Function trimTrailingZeros

internal/jsnum/string.go:265–273  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

263}
264
265func trimTrailingZeros(s string) string {
266 if strings.HasSuffix(s, "0") {
267 s = strings.TrimRight(s, "0")
268 if s == "" {
269 return "0"
270 }
271 }
272 return s
273}
274
275func stringToFloat64(s string) float64 {
276 if f, err := strconv.ParseFloat(s, 64); err == nil {

Callers 1

parseFloatStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected