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

Function LowerFirst

conversions.go:45–56  ·  view source on GitHub ↗

LowerFirst converts the first rune of str to lowercase.

(str T)

Source from the content-addressed store, hash-verified

43
44// LowerFirst converts the first rune of str to lowercase.
45func LowerFirst[T ~string](str T) T {
46 runes := []rune(str)
47 switch len(runes) {
48 case 0:
49 return ""
50 case 1:
51 return T(unicode.ToLower(runes[0]))
52 default:
53 runes[0] = unicode.ToLower(runes[0])
54 return T(runes)
55 }
56}
57
58// Without numbers returns the string with all numeric runes removed.
59//

Callers 1

TestLowerFirstFunction · 0.92

Calls 1

ToLowerMethod · 0.65

Tested by 1

TestLowerFirstFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…