---
name: "Misc.Utf8_lexeme"
section: "3o"
platform: "linux"
package: "ocaml"
version: "5.5.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Misc.Utf8_lexeme"
---

# Misc.Utf8\_lexeme(3o)

no description

## NAME

Misc.Utf8\_lexeme - no description

## Module

Module   Misc.Utf8\_lexeme

## Documentation

Module **Utf8\_lexeme**\
  :  **sig end**

*type t* =  **string**

*val normalize* :  **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.

*val capitalize* :  **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.

*val uncapitalize* :  **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.

*val is\_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.

*val is\_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

*val is\_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.

*type validation\_result* =\
  \| Valid\
  \| Invalid\_character **of** **Uchar.t**   \
   (\* Character not allowed\
  \*)\
  \| Invalid\_beginning **of** **Uchar.t**   \
   (\* Character not allowed as first char\
  \*)

*val validate\_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.

*val starts\_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.
