package zed

  1. Overview
  2. Docs
type t

The type for glyphs.

type char_prop =
  1. | Printable of int
  2. | Other
  3. | Null
    (*

    The type of a character. It's Printable of width or Other(unprintable character) or Null(code 0).

    *)
val to_raw : t -> CamomileLibrary.UChar.t list
val to_array : t -> CamomileLibrary.UChar.t array

core char returns the core of the char

val combined : t -> CamomileLibrary.UChar.t list

combined char returns the combining marks of the char

val unsafe_of_utf8 : string -> t
val of_utf8 : string -> t
val to_utf8 : t -> string
val zero : t

The Character 0.

prop_uChar uChar returns the char_prop of uChar

val prop : t -> char_prop

prop ch returns the char_prop of ch

val is_printable : CamomileLibrary.UChar.t -> bool

Returns whether a UChar.t is a printable character or not.

val is_printable_core : CamomileLibrary.UChar.t -> bool

Returns whether a UChar.t is a printable character and its width is not zero.

val is_combining_mark : CamomileLibrary.UChar.t -> bool

Returns whether a UChar.t is a combining mark.

val size : t -> int

size ch returns the size (number of characters) of ch.

val length : t -> int

Aliase of size

val width : t -> int

width ch returns the width of ch.

val out_of_range : t -> int -> bool

out_of_range ch idx returns whether idx is out of range of ch.

val get : t -> int -> CamomileLibrary.UChar.t

get ch n returns the n-th character of ch.

val get_opt : t -> int -> CamomileLibrary.UChar.t option

get ch n returns an optional value of the n-th character of ch.

val append : t -> CamomileLibrary.UChar.t -> t

append ch cm append the combining mark cm to ch and returns it. If cm is not a combining mark, then the original ch is returned.

val compare_core : t -> t -> int

compare_core ch1 ch2 compares the core components of ch1 and ch2

val compare_raw : t -> t -> int

compare_raw ch1 ch2 compares over the internal characters of ch1 and ch2 sequentially

val compare : t -> t -> int

Alias of compare_raw

val mix_uChar : t -> CamomileLibrary.UChar.t -> (t, t) Result.result

mix_uChar ch uChar tries to append uChar ch and returns Ok result. If uChar is not a combining mark, then an Error (Zed_char.t consists of uChar) is returned.

val of_uChars : ?trim:bool -> CamomileLibrary.UChar.t list -> t option * CamomileLibrary.UChar.t list

of_uChars uChars transforms uChars to a tuple. The first value is an optional Zed_char.t and the second one is a list of remaining uChars. This function creates a Zed_char.t if the first uChar in uChars is a printable standalone glyph, and then, it appends all following combining marks to the Zed_char.t. After that, all remaining uChars returned as the second value in the tuple. Otherwise, if the first uChar is not printable or standalone glyph, the result will be (None, all uChars).

val zChars_of_uChars : ?trim:bool -> CamomileLibrary.UChar.t list -> t list * CamomileLibrary.UChar.t list

zChars of_uChars uChars transforms uChars to a tuple. The first value is a list of Zed_char.t and the second one is a list of remaining uChars.

val unsafe_of_char : char -> t

unsafe_of_char ch returns a Zed_char.t whose core is ch

val unsafe_of_uChar : CamomileLibrary.UChar.t -> t

unsafe_of_uChar ch returns a Zed_char.t whose core is ch

val for_all : (CamomileLibrary.UChar.t -> bool) -> t -> bool

for_all p zChar checks if all elements of zChar satisfy the predicate p.

val iter : (CamomileLibrary.UChar.t -> unit) -> t -> unit

iter f char applies f on all characters of char.

module US (US : CamomileLibrary.UnicodeString.Type) : sig ... end

Converting between UnicodeString.Type and Zed_char.t

OCaml

Innovation. Community. Security.