ocaml: phase 6 Char predicates (+7 tests, 461 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
Char.is_digit / is_alpha / is_alnum / is_whitespace / is_upper / is_lower / is_space — all written in OCaml using Char.code + ASCII range checks.
This commit is contained in:
@@ -377,6 +377,16 @@
|
||||
let chr n = _char_chr n
|
||||
let lowercase_ascii c = _string_lower c
|
||||
let uppercase_ascii c = _string_upper c
|
||||
let is_digit c =
|
||||
let n = _char_code c in n >= 48 && n <= 57
|
||||
let is_lower c =
|
||||
let n = _char_code c in n >= 97 && n <= 122
|
||||
let is_upper c =
|
||||
let n = _char_code c in n >= 65 && n <= 90
|
||||
let is_alpha c = is_lower c || is_upper c
|
||||
let is_alnum c = is_alpha c || is_digit c
|
||||
let is_whitespace c =
|
||||
c = \" \" || c = \"\\t\" || c = \"\\n\" || c = \"\\r\"
|
||||
end ;;
|
||||
|
||||
module Int = struct
|
||||
|
||||
Reference in New Issue
Block a user