MCPcopy Create free account
hub / github.com/couchbase/cbft / camelToUnderscore

Function camelToUnderscore

ns_server.go:851–864  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

849}
850
851func camelToUnderscore(name string) string {
852 rv := ""
853 for i, r := range name {
854 if unicode.IsUpper(r) && i != 0 {
855 rv += "_"
856 rv += string(unicode.ToLower(r))
857 } else if unicode.IsUpper(r) && i == 0 {
858 rv += string(unicode.ToLower(r))
859 } else {
860 rv += string(r)
861 }
862 }
863 return rv
864}
865
866// ---------------------------------------------------
867

Callers 2

convertStatNameFunction · 0.85
TestCamelToUnderscoreFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestCamelToUnderscoreFunction · 0.68