MCPcopy Index your code
hub / github.com/rilldata/rill / toPascalCase

Function toPascalCase

runtime/parser/parse_api.go:132–148  ·  view source on GitHub ↗

toPascalCase converts a string to PascalCase. The string may contain underscores and dashes, which will be treated as word separators.

(s string)

Source from the content-addressed store, hash-verified

130// toPascalCase converts a string to PascalCase.
131// The string may contain underscores and dashes, which will be treated as word separators.
132func toPascalCase(s string) string {
133 if s == "" {
134 return s
135 }
136
137 words := strings.FieldsFunc(s, func(r rune) bool {
138 return r == '_' || r == '-' || r == ' '
139 })
140
141 for i, word := range words {
142 if word != "" {
143 words[i] = string(unicode.ToUpper(rune(word[0]))) + word[1:]
144 }
145 }
146
147 return strings.Join(words, "")
148}

Callers 2

TestToPascalCaseFunction · 0.85
parseAPIMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestToPascalCaseFunction · 0.68