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

Function WriteUpperFirstLowerRest

token/token.go:68–79  ·  view source on GitHub ↗

WriteUpperFirstLowerRest writes the first rune as upper case and the rest as lower case

(b *strings.Builder, caser Caser, s string)

Source from the content-addressed store, hash-verified

66// WriteUpperFirstLowerRest writes the first rune as upper case and the rest as
67// lower case
68func WriteUpperFirstLowerRest(b *strings.Builder, caser Caser, s string) {
69 for i, r := range s {
70 switch {
71 case i == 0 && b.Len() == 0:
72 b.WriteRune(caser.ToTitle(r))
73 case i == 0 && b.Len() > 0:
74 b.WriteRune(caser.ToUpper(r))
75 default:
76 b.WriteRune(caser.ToLower(r))
77 }
78 }
79}
80
81// WriteLowerFirstUpperRest writes the first rune as upper case and the rest are
82// separated by sep and written as lower case

Callers 2

writeTokenMethod · 0.92

Calls 4

ToTitleMethod · 0.65
ToUpperMethod · 0.65
ToLowerMethod · 0.65
LenMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…