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

Method SnakeCase

stringy.go:330–335  ·  view source on GitHub ↗

SnakeCase is variadic function that takes one Param slice of strings named rule and it returns passed string in snake case form. Rule param helps to omit character you want to omit from string. By default special characters like "_", "-","."," " are treated like word separator and treated accordingl

(rule ...string)

Source from the content-addressed store, hash-verified

328// like word separator and treated accordingly by default and you don't have to worry about it.
329// If you don't want to omit any character pass nothing.
330func (i *input) SnakeCase(rule ...string) StringManipulation {
331 input := getInput(*i)
332 wordArray := caseHelper(input, false, rule...)
333 i.Result = strings.Join(wordArray, "_")
334 return i
335}
336
337// Surround takes one param with which is used to surround user input and it
338// can be chained on function which return StringManipulation interface.

Callers

nothing calls this directly

Calls 2

getInputFunction · 0.85
caseHelperFunction · 0.85

Tested by

no test coverage detected