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

Method writeToken

converter.go:182–202  ·  view source on GitHub ↗
(b *strings.Builder, style Style, join string, tok string)

Source from the content-addressed store, hash-verified

180}
181
182func (sc StdConverter) writeToken(b *strings.Builder, style Style, join string, tok string) {
183 if len(join) > 0 && b.Len() > 0 {
184 b.WriteString(join)
185 }
186 switch style {
187 case StyleCamel:
188 token.WriteUpperFirstLowerRest(b, sc.caser, tok)
189 case StyleLowerCamel:
190 if b.Len() == 0 {
191 token.WriteLower(b, sc.caser, tok)
192 } else {
193 token.WriteUpperFirstLowerRest(b, sc.caser, tok)
194 }
195 case StyleScreaming:
196 token.WriteUpper(b, sc.caser, tok)
197 case StyleLower:
198 token.WriteLower(b, sc.caser, tok)
199 default:
200 b.WriteString(tok)
201 }
202}
203
204func (sc StdConverter) writeReplaceSplit(b *strings.Builder, style Style, join string, s []rune) {
205 switch style {

Callers 1

ConvertMethod · 0.95

Calls 4

WriteUpperFirstLowerRestFunction · 0.92
WriteLowerFunction · 0.92
WriteUpperFunction · 0.92
LenMethod · 0.45

Tested by

no test coverage detected