package batteries

  1. Overview
  2. Docs
On This Page
  1. Boilerplate code
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module BatCharSource

Operations on characters.

Characters range upon Latin-1 encoding, i.e. languages used in Western Europe and North America. For international characters, another, richer, module is provided: UChar.

  • author Xavier Leroy (base module)
  • author David Teller
Sourceval code : char -> int

Return the ASCII code of the argument.

Sourceval chr : int -> char

Return the character with the given ASCII code.

Sourceval escaped : char -> string

Return a string representing the given character, with special characters escaped following the lexical conventions of OCaml.

Sourceval lowercase_ascii : char -> char

Convert the given character to its equivalent lowercase character, using the US-ASCII character set.

  • since 2.5.0
Sourceval uppercase_ascii : char -> char

Convert the given character to its equivalent uppercase character, using the US-ASCII character set.

  • since 2.5.0
Sourcetype t = char

An alias for the type of characters.

Sourceval is_whitespace : char -> bool

Determine if a character is a whitespace. Whitespace characters are defined as ' ', '\010', '\013', '\009', '\026' and '\012'.

Sourceval is_uppercase : char -> bool

Determine if a character is uppercase ASCII. A character is uppercase ASCII if it is between 'A' and 'Z'

Sourceval is_lowercase : char -> bool

Determine if a character is lowercase ASCII. A character is lowercase ASCII if it is between 'a' and 'z'

Sourceval is_uppercase_latin1 : char -> bool

Determine if a character is uppercase Latin 1. A character is uppercase Latin 1 if it is between 'A' and 'Z', between 'À' and 'Ö' or between 'Ø' and 'Ý'

Sourceval is_lowercase_latin1 : char -> bool

Determine if a character is lowercase Latin 1. A character is lowercase Latin 1 if it is between 'a' and 'z', between 'Þ' and 'ö' or between 'ø' and 'ÿ'

Sourceval is_latin1 : char -> bool

Determine if a character is a Latin 1 letter. A character is a Latin 1 letter if it is either an uppercase or a lowercase Latin 1 character.

Sourceval is_digit : char -> bool

Determine if a character represents a digit. Digits are '0', '1', ... '9'.

Sourceval is_symbol : char -> bool

Determine if a character represents a (OCaml-style) symbol. Symbols are '!', '%', '&', '$', '#', '+', '-', '/', ':', '<', '=' '>', '?', '@', '\\', '~', '^', '|', '*'

Sourceval is_letter : char -> bool

Determine if a character represents a ASCII letter.

Sourceval is_newline : char -> bool

Determine if a character is a newline. Newline characters are defined as '\010' and '\013'

Sourceval of_digit : int -> char

Return the character representing a given digit.

Sourceval enum : unit -> char BatEnum.t

Produce the enumeration of all characters

Sourceval range : ?until:char -> char -> char BatEnum.t

range from ?until produces an enumeration of the characters from from to until included until defaults to '\255'

Sourceval (--) : char -> char -> char BatEnum.t

Produce the enumeration of a segment of characters.

'a' -- 'z' is the enumeration of all characters between 'a' and 'z' included.

Sourcemodule Infix : sig ... end

Boilerplate code

Sourceval print : 'a BatInnerIO.output -> Char.t -> unit
Sourceval compare : t -> t -> int

The comparison function for characters, with the same specification as Pervasives.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.

Sourceval equal : t -> t -> bool
Sourceval hash : t -> int
Sourceval seeded_hash : int -> t -> int
Sourceval ord : char BatOrd.ord
Sourcemodule Incubator : sig ... end
OCaml

Innovation. Community. Security.