MCPcopy Index your code
hub / github.com/segmentio/encoding / appendToLower

Function appendToLower

json/parse.go:752–774  ·  view source on GitHub ↗
(b, s []byte)

Source from the content-addressed store, hash-verified

750}
751
752func appendToLower(b, s []byte) []byte {
753 if ascii.Valid(s) { // fast path for ascii strings
754 i := 0
755
756 for j := range s {
757 c := s[j]
758
759 if 'A' <= c && c <= 'Z' {
760 b = append(b, s[i:j]...)
761 b = append(b, c+('a'-'A'))
762 i = j + 1
763 }
764 }
765
766 return append(b, s[i:]...)
767 }
768
769 for _, r := range string(s) {
770 b = appendRune(b, foldRune(r))
771 }
772
773 return b
774}
775
776func foldRune(r rune) rune {
777 if r = unicode.SimpleFold(r); 'A' <= r && r <= 'Z' {

Callers 3

TestAppendToLowerFunction · 0.85
BenchmarkAppendToLowerFunction · 0.85
decodeStructMethod · 0.85

Calls 3

ValidFunction · 0.92
appendRuneFunction · 0.85
foldRuneFunction · 0.85

Tested by 2

TestAppendToLowerFunction · 0.68
BenchmarkAppendToLowerFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…