
louise
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#1199 · main · 10 min 33 s
1Étoiles
0Forks
0Issues
| 1 | // string.eq_ignore_ascii_case: ASCII case only; anything else compares |
| 2 | // bytewise (issue #179 §1e, Phase 5). |
| 3 | |
| 4 | import std/io |
| 5 | import std/string |
| 6 | |
| 7 | pub fn main :: -> () / <io> |
| 8 | { |
| 9 | // Case variations of ASCII letters. |
| 10 | io.println (show (string.eq_ignore_ascii_case "content-type" "Content-Type")) |
| 11 | io.println (show (string.eq_ignore_ascii_case "HOST" "host")) |
| 12 | io.println (show (string.eq_ignore_ascii_case "aBc" "AbC")) |
| 13 | // Equal strings, and the empty string. |
| 14 | io.println (show (string.eq_ignore_ascii_case "same" "same")) |
| 15 | io.println (show (string.eq_ignore_ascii_case "" "")) |
| 16 | // Different letters, different lengths, and case outside ASCII. |
| 17 | io.println (show (string.eq_ignore_ascii_case "abc" "abd")) |
| 18 | io.println (show (string.eq_ignore_ascii_case "ab" "abc")) |
| 19 | io.println (show (string.eq_ignore_ascii_case "abc" "ab")) |
| 20 | io.println (show (string.eq_ignore_ascii_case "" "a")) |
| 21 | // Non-ASCII bytes are not case-folded: é and É differ, as does a |
| 22 | // digit from its keyboard "case". |
| 23 | io.println (show (string.eq_ignore_ascii_case "café" "cafÉ")) |
| 24 | io.println (show (string.eq_ignore_ascii_case "café" "café")) |
| 25 | io.println (show (string.eq_ignore_ascii_case "a1" "a!")) |
| 26 | // Punctuation and symbols compare bytewise. |
| 27 | io.println (show (string.eq_ignore_ascii_case "x-request-id" "X-Request-Id")) |
| 28 | io.println (show (string.eq_ignore_ascii_case "a b" "a b")) |
| 29 | } |
| 30 | //> True |
| 31 | //> True |
| 32 | //> True |
| 33 | //> True |
| 34 | //> True |
| 35 | //> False |
| 36 | //> False |
| 37 | //> False |
| 38 | //> False |
| 39 | //> False |
| 40 | //> True |
| 41 | //> False |
| 42 | //> True |
| 43 | //> False |