MCPcopy Create free account
hub / github.com/apache/fory / SnakeCase

Function SnakeCase

go/fory/util.go:60–74  ·  view source on GitHub ↗
(camel string)

Source from the content-addressed store, hash-verified

58}
59
60func SnakeCase(camel string) string {
61 var buf bytes.Buffer
62 for _, c := range camel {
63 if 'A' <= c && c <= 'Z' {
64 // just convert [A-Z] to _[a-z]
65 if buf.Len() > 0 {
66 buf.WriteRune('_')
67 }
68 buf.WriteRune(c - 'A' + 'a')
69 } else {
70 buf.WriteRune(c)
71 }
72 }
73 return buf.String()
74}
75
76// Float32bits returns the IEEE 754 binary representation of f,
77// with the sign bit of f and the result in the same bit position.

Callers 6

TestSnakeFunction · 0.85
initFieldsMethod · 0.85
computeHashMethod · 0.85
getSortKeyTextMethod · 0.85
lessTripleSortKeyFunction · 0.85
parseFieldSpecFunction · 0.85

Calls 2

LenMethod · 0.80
StringMethod · 0.45

Tested by 1

TestSnakeFunction · 0.68