equalASCIIFold returns true if s is equal to t with ASCII case folding as defined in RFC 4790.
(s, t string)
| 176 | // equalASCIIFold returns true if s is equal to t with ASCII case folding as |
| 177 | // defined in RFC 4790. |
| 178 | func equalASCIIFold(s, t string) bool { |
| 179 | for s != "" && t != "" { |
| 180 | sr, size := utf8.DecodeRuneInString(s) |
| 181 | s = s[size:] |
| 182 | tr, size := utf8.DecodeRuneInString(t) |
| 183 | t = t[size:] |
| 184 | if sr == tr { |
| 185 | continue |
| 186 | } |
| 187 | if 'A' <= sr && sr <= 'Z' { |
| 188 | sr = sr + 'a' - 'A' |
| 189 | } |
| 190 | if 'A' <= tr && tr <= 'Z' { |
| 191 | tr = tr + 'a' - 'A' |
| 192 | } |
| 193 | if sr != tr { |
| 194 | return false |
| 195 | } |
| 196 | } |
| 197 | return s == t |
| 198 | } |
| 199 | |
| 200 | // tokenListContainsValue returns true if the 1#token header with the given |
| 201 | // name contains a token equal to value with ASCII case folding. |
no outgoing calls
searching dependent graphs…