MCPcopy Create free account
hub / github.com/gobeam/stringy / CamelCase

Method CamelCase

stringy.go:122–135  ·  view source on GitHub ↗

CamelCase is variadic function which takes one Param rule i.e slice of strings and it returns input type string in camel case form and rule helps to omit character you want to omit from string. By default special characters like "_", "-","."," " are l\treated like word separator and treated accordin

(rule ...string)

Source from the content-addressed store, hash-verified

120// Example input: hello user
121// Result : helloUser
122func (i *input) CamelCase(rule ...string) StringManipulation {
123 input := getInput(*i)
124 // removing excess space
125 wordArray := caseHelper(input, true, rule...)
126 for i, word := range wordArray {
127 if i == 0 {
128 wordArray[i] = strings.ToLower(word)
129 } else {
130 wordArray[i] = ucfirst(word)
131 }
132 }
133 i.Result = strings.Join(wordArray, "")
134 return i
135}
136
137// PascalCase is variadic function which takes one Param rule i.e slice of strings and it returns
138// input type string in camel case form and rule helps to omit character you want to omit from string.

Callers

nothing calls this directly

Calls 4

getInputFunction · 0.85
caseHelperFunction · 0.85
ucfirstFunction · 0.85
ToLowerMethod · 0.65

Tested by

no test coverage detected