MCPcopy Create free account
hub / github.com/apache/fory / EncodeAllToLowerSpecial

Method EncodeAllToLowerSpecial

go/fory/meta/meta_string_encoder.go:111–125  ·  view source on GitHub ↗
(input string)

Source from the content-addressed store, hash-verified

109}
110
111func (e *Encoder) EncodeAllToLowerSpecial(input string) ([]byte, error) {
112 chars := make([]byte, len(input)+countUppers(input))
113 idx := 0
114 for i := 0; i < len(input); i++ {
115 if input[i] >= 'A' && input[i] <= 'Z' {
116 chars[idx] = '|'
117 chars[idx+1] = input[i] - 'A' + 'a'
118 idx += 2
119 } else {
120 chars[idx] = input[i]
121 idx += 1
122 }
123 }
124 return e.EncodeGeneric(chars, 5)
125}
126
127func (e *Encoder) EncodeGeneric(chars []byte, bitsPerChar int) (result []byte, err error) {
128 totBits := len(chars)*bitsPerChar + 1

Callers 1

EncodeWithEncodingMethod · 0.95

Calls 2

EncodeGenericMethod · 0.95
countUppersFunction · 0.85

Tested by

no test coverage detected