package containers

  1. Overview
  2. Docs
A modular, clean and powerful extension of the OCaml standard library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

containers-3.18.tbz
sha256=52eeff91ce42b52305e6aaa8a58b88ce8f0a5a984199e59ca7e2fd9ebabe61d7
sha512=dc7337e6cbc9850542c7c9228d3bcb4e4add57a55e2a2992f21fb4761b3e10a68ef1d57ca37a7f5b303fc875fe3df5ecb69dbf2930bfcd1561ce03f7ae83e24b

doc/containers/CCChar/index.html

Module CCCharSource

Utils around char

  • since 0.14

Characters

Sourcetype t = char

An alias for the type of characters.

Sourceval code : char -> int

code c is the byte corresponding to c. If c is an ASCII character this corresponds to its encoding in ASCII or UTF-8.

Sourceval chr : int -> char

Return the character with the given integer code.

Sourceval escaped : char -> string

Return a string representing the given character, with special characters escaped following the lexical conventions of OCaml. All characters outside the ASCII printable range [0x20;0x7E] are escaped, as well as backslash, double-quote, and single-quote.

Predicates and comparisons

See also the Ascii module.

Sourceval compare : t -> t -> int

The comparison function for characters, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Char to be passed as argument to the functors Set.Make and Map.Make. The order is compatible with Char.code.

Sourceval equal : t -> t -> bool

The equal function for chars.

  • since 4.03

ASCII characters

Sourcemodule Ascii = Char.Ascii

ASCII character set support.

Sourceval lowercase_ascii : char -> char

Use the equivalent Ascii.lowercase instead.

  • since 4.03
Sourceval uppercase_ascii : char -> char

Use the equivalent Ascii.uppercase instead.

  • since 4.03

Hashing

Sourceval seeded_hash : int -> t -> int

A seeded hash function for characters, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

  • since 5.1
Sourceval hash : t -> int

An unseeded hash function for characters, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

  • since 5.1
Sourceval of_int_exn : int -> t

Alias to Char.chr. Return the character with the given ASCII code.

  • since 1.0
Sourceval of_int : int -> t option

Safe version of of_int_exn.

  • since 1.0
Sourceval to_int : t -> int

Alias to Char.code. Return the ASCII code of the argument.

  • since 1.0
Sourceval to_string : t -> string

to_string c returns a string containing c

  • since 2.7
Sourceval pp_buf : Buffer.t -> t -> unit

Renamed from pp since 2.0.

Sourceval pp : Format.formatter -> t -> unit

Renamed from print since 2.0.

Sourceval is_uppercase_ascii : t -> bool

is_uppercase_ascii c is true exactly when c is an uppercase ASCII character, i.e. '\064' < c < '\091'.

  • since 3.16
Sourceval is_lowercase_ascii : t -> bool

is_lowercase_ascii c is true exactly when c is a lowercase ASCII character, i.e. '\096' < c < '\123'.

  • since 3.16
Sourceval is_letter_ascii : t -> bool

is_letter_ascii c is true exactly when c is an ASCII letter, i.e. is_uppercase_ascii c || is_lowercase_ascii c.

  • since 3.16
Sourceval is_digit_ascii : t -> bool

is_digit_ascii c is true exactly when c is an ASCII digit, i.e. '\047' < c < '\058'.

  • since 3.16
Sourceval is_whitespace_ascii : t -> bool

is_whitespace_ascii c is true exactly when c is an ASCII whitespace character as defined by Unicode, i.e. either c = ' ' or '\008' < c < '\014'.

  • since 3.16

Infix Operators

  • since 3.3
Sourcemodule Infix : sig ... end
include module type of Infix
Sourceval (=) : t -> t -> bool
  • since 3.3
Sourceval (<>) : t -> t -> bool
  • since 3.3
Sourceval (<) : t -> t -> bool
  • since 3.3
Sourceval (>) : t -> t -> bool
  • since 3.3
Sourceval (<=) : t -> t -> bool
  • since 3.3
Sourceval (>=) : t -> t -> bool
  • since 3.3