package tablecloth-native

  1. Overview
  2. Docs

Source file TableclothChar.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
module Comparator = TableclothComparator

type t = char

include TableclothComparator.Make (struct
  type nonrec t = t

  let compare = compare
end)

let toCode (c : char) : int = Base.Char.to_int c

let to_code = toCode

let fromCode (i : int) : char option =
  if 0 <= i && i <= 255 then Some (Char.chr i) else None


let from_code = fromCode

let toString = Base.Char.to_string

let to_string = toString

let fromString (str : string) : char option =
  match String.length str with 1 -> Some str.[0] | _ -> None


let from_string = fromString

let toDigit char =
  match char with '0' .. '9' -> Some (toCode char - toCode '0') | _ -> None


let to_digit = toDigit

let toLowercase = Base.Char.lowercase

let to_lowercase = toLowercase

let toUppercase = Base.Char.uppercase

let to_uppercase = toUppercase

let isLowercase = Base.Char.is_lowercase

let is_lowercase = isLowercase

let isUppercase = Base.Char.is_uppercase

let is_uppercase = isUppercase

let isLetter = Base.Char.is_alpha

let is_letter = isLetter

let isDigit = Base.Char.is_digit

let is_digit = isDigit

let isAlphanumeric = Base.Char.is_alphanum

let is_alphanumeric = isAlphanumeric

let isPrintable = Base.Char.is_print

let is_printable = isPrintable

let isWhitespace = Base.Char.is_whitespace

let is_whitespace = isWhitespace

let equal : char -> char -> bool = ( = )

let compare = compare