Module Base.Uchar
Unicode character operations.
type t
= Base__.Uchar0.t
val compare : t -> t -> int
val hash_fold_t : Hash.state -> t -> Hash.state
val hash : t -> Hash.hash_value
include Comparable.S with type t := t
include Base__.Comparable_intf.Polymorphic_compare
val ascending : t -> t -> int
ascending
is identical tocompare
.descending x y = ascending y x
. These are intended to be mnemonic when used likeList.sort ~compare:ascending
andList.sort ~cmp:descending
, since they cause the list to be sorted in ascending or descending order, respectively.
val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
between t ~low ~high
meanslow <= t <= high
val clamp_exn : t -> min:t -> max:t -> t
clamp_exn t ~min ~max
returnst'
, the closest value tot
such thatbetween t' ~low:min ~high:max
is true.Raises if
not (min <= max)
.
val clamp : t -> min:t -> max:t -> t Or_error.t
include Comparator.S with type t := t
val comparator : (t, comparator_witness) Comparator.comparator
include Base__.Comparable_intf.Validate with type t := t
val validate_lbound : min:t Maybe_bound.t -> t Validate.check
val validate_ubound : max:t Maybe_bound.t -> t Validate.check
val validate_bound : min:t Maybe_bound.t -> max:t Maybe_bound.t -> t Validate.check
val succ : t -> t option
succ_exn t
is the scalar value aftert
in the set of Unicode scalar values, and raises ift = max_value
.
val succ_exn : t -> t
val pred : t -> t option
pred_exn t
is the scalar value beforet
in the set of Unicode scalar values, and raises ift = min_value
.
val pred_exn : t -> t
val is_char : t -> bool
is_char t
istrue
iffn
is in the latin-1 character set.
val to_char : t -> char option
to_char_exn t
ist
as achar
if it is in the latin-1 character set, and raises otherwise.
val int_is_scalar : int -> bool
int_is_scalar n
istrue
iffn
is an Unicode scalar value (i.e., in the ranges0x0000
...0xD7FF
or0xE000
...0x10FFFF
).
val of_scalar : int -> t option
of_scalar_exn n
isn
as a Unicode character. Raises ifnot (int_is_scalar i)
.