module BC_Char: sig end
An extention of the standard Char module.
Inherits all functions from Char with a few more functions of our own.
Author(s): Hideo Bannai
Conversion tables useful for efficient char <-> int conversions
type c2i_table
type i2c_table
exception IntOutOfBounds of int
val make_c2i_table : ?default:int -> ?case_insensitive:bool -> string array -> c2i_table
Make conversion table of char -> int from a string array.
For each string at position i of the array, each character of the
string is associated with i. (The range of the conversion is limited from
0 to l-1 where l is the length of the array)
Raises Invalid_argument if the same character corresponds to
more than one value, or if any of the strings are empty.
An optional default (default=-1) value can be specified for characters not
appearing in the string array.
val make_i2c_table : string -> i2c_table
Make conversion table of int -> char from a string.
For a given i, the ith character of the string is associated.
(The domain of the conversion is limited from 0 to l-1 where l is the
length of the string).
val make_bij_table : ?case_insensitive:bool -> string -> i2c_table * c2i_table
Make a table for the bijection (one-to-one correspondance) between each
character of the string, and its position. Returns the pair of conversion
tables for both ways.
val conv_c2i : c2i_table -> char -> int
Convert a character to integer using the conversion table.
val conv_i2c : i2c_table -> int -> char
Convert an integer to a character. Raises IntOutOfBounds if
the integer does not correspond to any characters.
If
BC_Char.make_c2i_table was used, the first character of the string
at position i of the array given to
BC_Char.make_c2i_table is returned.
The following are functions of the standard Char module.
See the OCaml manual for documentation.
|
val code : char -> int
val chr : int -> char
val escaped : char -> string
val lowercase : char -> char
val uppercase : char -> char
type t = char
val compare : t -> t -> int
val unsafe_chr : int -> char