mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-08 04:05:30 -05:00
26 lines
548 B
OCaml
26 lines
548 B
OCaml
(* This file is free software, part of containers. See file "license" for more details. *)
|
|
|
|
(** {1 Utils around char}
|
|
|
|
@since 0.14 *)
|
|
|
|
include Char
|
|
|
|
let equal (a:char) b = a=b
|
|
|
|
let pp = Buffer.add_char
|
|
let print = Format.pp_print_char
|
|
|
|
let of_int_exn = Char.chr
|
|
let of_int c = try Some (of_int_exn c) with _ -> None
|
|
let to_int = Char.code
|
|
|
|
let lowercase_ascii c =
|
|
if c >= 'A' && c <= 'Z'
|
|
then Char.unsafe_chr (Char. code c + 32)
|
|
else c
|
|
|
|
let uppercase_ascii c =
|
|
if c >= 'a' && c <= 'z'
|
|
then Char.unsafe_chr (Char.code c - 32)
|
|
else c
|