Char
char represents one Unicode scalar value.
It is not a one-character string. A char can encode to one to four UTF-8 bytes, and Flint keeps that distinction explicit so text APIs stay predictable across MCU and host targets.
Basic Usage
let newline: char = '\n'
let letter: char = 'A'
let accent: char = 'é'
UTF-8 Helpers
The built-in char substrate exposes the minimum helpers needed for portable text code:
let ch = 'é'
let width: usize = ch.utf8_len()
let first: u8 = ch.utf8_byte(0)
utf8_len()returns how many UTF-8 bytes the scalar usesutf8_byte(index)returns one encoded UTF-8 byte
These helpers are what allow std/text to stay mostly Flint code instead of pushing text algorithms into each backend.
ASCII Classification
Current shipped character classification is explicit about being ASCII-only:
let ch = 'A'
let letter = ch.is_ascii_letter()
let digit = ch.is_ascii_digit()
let alpha_num = ch.is_ascii_alphanumeric()
let whitespace = ch.is_ascii_whitespace()
let symbol = ch.is_ascii_symbol()
let control = ch.is_ascii_control()
let upper = ch.is_ascii_upper()
let lower = ch.is_ascii_lower()
The explicit naming is intentional. Flint’s baseline text model is UTF-8 everywhere, but full Unicode classification is not part of the portable core text surface in 1.0.
Escape Forms
Chars support the standard Flint escape forms:
let newline = '\n'
let tab = '\t'
let nul = '\0'
let quote = '\''
let slash = '\\'
let hex = '\x41'
let smile = '\u{1F642}'
Byte chars use b'...' syntax and produce a u8:
let byte_a: u8 = b'A'
let byte_newline: u8 = b'\n'