Module: core.chars

Source: ./core/chars.reef


Overview

core.chars - Character classification and conversion functions

Provides functions for classifying characters (digit, alpha, whitespace, etc.) and converting between upper/lower case.


Functions

fn is_digit(c: char): bool

Checks if character is a decimal digit ('0'-'9')

fn is_alpha(c: char): bool

Checks if character is an alphabetic letter (a-z or A-Z)

fn is_alphanumeric(c: char): bool

Checks if character is alphanumeric (letter or digit)

fn is_upper(c: char): bool

Checks if character is uppercase (A-Z)

fn is_lower(c: char): bool

Checks if character is lowercase (a-z)

fn is_whitespace(c: char): bool

Checks if character is whitespace (space, tab, newline, carriage return)

fn is_ascii(c: char): bool

Checks if character is ASCII (0-127)

fn is_hex_digit(c: char): bool

Checks if character is a hexadecimal digit (0-9, a-f, A-F)

fn is_octal_digit(c: char): bool

Checks if character is an octal digit (0-7)

fn is_binary_digit(c: char): bool

Checks if character is a binary digit (0 or 1)

fn is_printable(c: char): bool

Checks if character is printable (space through tilde, ASCII 32-126)

fn is_control(c: char): bool

Checks if character is a control character (ASCII 0-31 and 127)

fn is_punct(c: char): bool

Checks if character is punctuation Punctuation is printable but not alphanumeric and not space

fn is_space(c: char): bool

Checks if character is a space character (same as is_whitespace)

fn is_blank(c: char): bool

Checks if character is a blank (space or tab only)

fn is_newline(c: char): bool

Checks if character is a newline (\n or \r)

fn char_upper(c: char): char

Converts character to uppercase (pure Reef implementation)

fn char_lower(c: char): char

Converts character to lowercase (pure Reef implementation)

fn to_upper(c: char): char

Alias for char_upper (more consistent naming)

fn to_lower(c: char): char

Alias for char_lower (more consistent naming)

fn to_digit(c: char): int

Converts digit character to integer (0-9) Returns -1 if not a digit

fn from_digit(n: int): char

Converts integer (0-9) to digit character Returns '?' if n is out of range

fn hex_to_digit(c: char): int

Converts hexadecimal digit character to integer (0-15) Returns -1 if not a hex digit

fn octal_to_digit(c: char): int

Converts octal digit character to integer (0-7) Returns -1 if not an octal digit

fn from_hex_digit(n: int): char

Converts integer (0-15) to hex digit character Returns '?' if n is out of range


Generated by reefc doc