9
)
10
11
>
func ConvertPathToCamel(input string) []string {
proto.go
12
>
var pathParts []string
13
>
for path := range strings.SplitSeq(input, ".") {
14
>
// Split by "_" and convert each word to Title Case (CamelCase)
15
>
var b strings.Builder
16
>
j := 0
17
>
for word := range strings.SplitSeq(path, "_") {
18
>
if j > 0 {
19
b.WriteString(cases.Title(language.Und).String(strings.ToLower(word)))
21
>
// lowercase the first letter
22
>
if len(word) > 0 {
23
>
b.WriteString(strings.ToLower(word[:1]))
24
>
if len(word) > 1 {
25
>
b.WriteString(word[1:])
26
>
}
27
}
28
}
30
}
31
// Join the words into a CamelCase substring
32
>
pathParts = append(pathParts, b.String())
proto.go
33
}
34
// Join all CamelCase substrings back with "."
36
}
37