1Uchar(3) OCaml library Uchar(3)
2
3
4
6 Uchar - Unicode characters.
7
9 Module Uchar
10
12 Module Uchar
13 : sig end
14
15
16 Unicode characters.
17
18
19 Since 4.03
20
21
22
23
24
25 type t
26
27
28 The type for Unicode characters.
29
30 A value of this type represents a Unicode scalar value which is an in‐
31 teger in the ranges 0x0000 ... 0xD7FF or 0xE000 ... 0x10FFFF .
32
33
34
35 val min : t
36
37
38 min is U+0000.
39
40
41
42 val max : t
43
44
45 max is U+10FFFF.
46
47
48
49 val bom : t
50
51
52 bom is U+FEFF, the byte order mark (BOM) character.
53
54
55 Since 4.06.0
56
57
58
59 val rep : t
60
61
62 rep is U+FFFD, the replacement character.
63
64
65 Since 4.06.0
66
67
68
69 val succ : t -> t
70
71
72 succ u is the scalar value after u in the set of Unicode scalar values.
73
74
75 Raises Invalid_argument if u is Uchar.max .
76
77
78
79 val pred : t -> t
80
81
82 pred u is the scalar value before u in the set of Unicode scalar val‐
83 ues.
84
85
86 Raises Invalid_argument if u is Uchar.min .
87
88
89
90 val is_valid : int -> bool
91
92
93 is_valid n is true iff n is a Unicode scalar value (i.e. in the ranges
94 0x0000 ... 0xD7FF or 0xE000 ... 0x10FFFF ).
95
96
97
98 val of_int : int -> t
99
100
101 of_int i is i as a Unicode character.
102
103
104 Raises Invalid_argument if i does not satisfy Uchar.is_valid .
105
106
107
108 val to_int : t -> int
109
110
111 to_int u is u as an integer.
112
113
114
115 val is_char : t -> bool
116
117
118 is_char u is true iff u is a latin1 OCaml character.
119
120
121
122 val of_char : char -> t
123
124
125 of_char c is c as a Unicode character.
126
127
128
129 val to_char : t -> char
130
131
132 to_char u is u as an OCaml latin1 character.
133
134
135 Raises Invalid_argument if u does not satisfy Uchar.is_char .
136
137
138
139 val equal : t -> t -> bool
140
141
142 equal u u' is u = u' .
143
144
145
146 val compare : t -> t -> int
147
148
149 compare u u' is Stdlib.compare u u' .
150
151
152
153 val hash : t -> int
154
155
156 hash u associates a non-negative integer to u .
157
158
159
160
161
162OCamldoc 2021-01-26 Uchar(3)