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

Function toSnakeCase

go/fory/codegen/utils.go:56–65  ·  view source on GitHub ↗

toSnakeCase converts CamelCase to snake_case

(s string)

Source from the content-addressed store, hash-verified

54
55// toSnakeCase converts CamelCase to snake_case
56func toSnakeCase(s string) string {
57 var result []rune
58 for i, r := range s {
59 if i > 0 && unicode.IsUpper(r) {
60 result = append(result, '_')
61 }
62 result = append(result, unicode.ToLower(r))
63 }
64 return string(result)
65}
66
67func getOptionalElementType(t types.Type) (types.Type, bool) {
68 t = types.Unalias(t)

Callers 1

analyzeFieldFunction · 0.85

Calls 1

stringFunction · 0.50

Tested by

no test coverage detected