MCPcopy Create free account
hub / github.com/zeromicro/go-zero / ToCamel

Method ToCamel

tools/goctl/util/stringx/string.go:64–73  ·  view source on GitHub ↗

ToCamel converts the input text into camel case

()

Source from the content-addressed store, hash-verified

62
63// ToCamel converts the input text into camel case
64func (s String) ToCamel() string {
65 list := s.splitBy(func(r rune) bool {
66 return r == '_'
67 }, true)
68 var target []string
69 for _, item := range list {
70 target = append(target, From(item).Title())
71 }
72 return strings.Join(target, "")
73}
74
75// ToSnake converts the input text into snake case
76func (s String) ToSnake() string {

Callers 15

genNewFunction · 0.80
genCacheKeyFunction · 0.80
CamelMethod · 0.80
genFindOneFunction · 0.80
genUpdateFunction · 0.80
genTypesFunction · 0.80
genDeleteFunction · 0.80
genModelCustomMethod · 0.80
genVarsFunction · 0.80
genTableNameFunction · 0.80
genCustomizedFunction · 0.80
genInsertFunction · 0.80

Calls 4

splitByMethod · 0.95
JoinMethod · 0.80
FromFunction · 0.70
TitleMethod · 0.45

Tested by 1

TestString_Snake2CamelFunction · 0.64