MCPcopy Create free account
hub / github.com/chanced/caps / WriteSplitLowerFirstUpperRestRunes

Function WriteSplitLowerFirstUpperRestRunes

token/token.go:89–104  ·  view source on GitHub ↗

WriteSplitLowerFirstUpperRestRunes writes the first rune as upper case and the rest are separated by sep and written as lower case

(b *strings.Builder, caser Caser, sep string, s []rune)

Source from the content-addressed store, hash-verified

87// WriteSplitLowerFirstUpperRestRunes writes the first rune as upper case and
88// the rest are separated by sep and written as lower case
89func WriteSplitLowerFirstUpperRestRunes(b *strings.Builder, caser Caser, sep string, s []rune) {
90 for i, r := range s {
91 if i == 0 && b.Len() == 0 {
92 b.WriteRune(caser.ToLower(r))
93 } else if b.Len() > 0 {
94 if len(sep) > 0 {
95 b.WriteString(sep)
96 }
97 if i == 0 {
98 b.WriteRune(caser.ToLower(r))
99 } else {
100 b.WriteRune(caser.ToUpper(r))
101 }
102 }
103 }
104}
105
106// WriteSplitLower writes all strings in elems separated by sep and written as lower case
107func WriteSplitLower(b *strings.Builder, caser Caser, sep string, elems ...string) {

Callers 2

writeReplaceSplitMethod · 0.92

Calls 3

ToLowerMethod · 0.65
ToUpperMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…