MCPcopy Create free account
hub / github.com/google/gapid / SplitUpperCase

Method SplitUpperCase

gapil/template/strings.go:106–127  ·  view source on GitHub ↗

SplitUpperCase slices each string segment before and after each upper-case rune.

(v ...interface{})

Source from the content-addressed store, hash-verified

104// SplitUpperCase slices each string segment before and after each upper-case
105// rune.
106func (Functions) SplitUpperCase(v ...interface{}) stringList {
107 l := stringify(v...)
108 out := stringList{}
109 for _, s := range l {
110 str := ""
111 for _, r := range s {
112 if unicode.IsUpper(r) {
113 if len(str) > 0 {
114 out = append(out, str)
115 str = ""
116 }
117 out = append(out, string(r))
118 } else {
119 str += string(r)
120 }
121 }
122 if len(str) > 0 {
123 out = append(out, str)
124 }
125 }
126 return out
127}
128
129// SplitPascalCase slices each string segment at each transition from an letter
130// rune to a upper-case letter rune.

Callers 2

TestSplitUpperCaseFunction · 0.80

Calls 1

stringifyFunction · 0.85

Tested by 2

TestSplitUpperCaseFunction · 0.64