Module Utf8_lexeme
: sigendtypet = stringvalnormalize : string->(t,t)Result.t
Normalize the given UTF-8 encoded string. Invalid UTF-8 sequences results in a error and are replaced by
U+FFFD. Identifier characters are put in NFC normalized form. Other Unicode characters are left
unchanged.
valcapitalize : string->(t,t)Result.t
Like normalize , but if the string starts with a lowercase identifier character, it is replaced by the
corresponding uppercase character. Subsequent characters are not changed.
valuncapitalize : string->(t,t)Result.t
Like normalize , but if the string starts with an uppercase identifier character, it is replaced by the
corresponding lowercase character. Subsequent characters are not changed.
valis_capitalized : t->bool
Returns true if the given normalized string starts with an uppercase identifier character, false
otherwise. May return wrong results if the string is not normalized.
valis_valid_identifier : t->bool
Check whether the given normalized string is a valid OCaml identifier:
-all characters are identifier characters
-it does not start with a digit or a single quote
valis_lowercase : t->bool
Returns true if the given normalized string only contains lowercase identifier character, false
otherwise. May return wrong results if the string is not normalized.
typevalidation_result =
| Valid
| Invalid_character ofUchar.t
(* Character not allowed
*)
| Invalid_beginning ofUchar.t
(* Character not allowed as first char
*)
valvalidate_identifier : ?with_dot:bool->t->validation_result
Like is_valid_identifier , but returns a more detailed error code. Dots can be allowed to extend support
to path-like identifiers.
valstarts_like_a_valid_identifier : t->bool
Checks whether the given normalized string starts with an identifier character other than a digit or a
single quote. Subsequent characters are not checked.
OCamldoc 2025-06-12 Misc.Utf8_lexeme(3o)