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

Function trimLeadingZeros

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

Source from the content-addressed store, hash-verified

253}
254
255func trimLeadingZeros(s string) string {
256 if strings.HasPrefix(s, "0") {
257 s = strings.TrimLeft(s, "0")
258 if s == "" {
259 return "0"
260 }
261 }
262 return s
263}
264
265func trimTrailingZeros(s string) string {
266 if strings.HasSuffix(s, "0") {

Callers 2

tryParseIntFunction · 0.85
parseFloatStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected