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), including DEL.

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 to_upper(c: char): char

Converts character to uppercase (pure Reef implementation). 0.9.2 C4: this WAS char_upper, with to_upper a one-line alias in front of it. The alias pair is gone; to_upper is the name.

fn to_lower(c: char): char

Converts character to lowercase (pure Reef implementation). 0.9.2 C4: was char_lower; see to_upper above.

fn to_digit(c: char): option.Option[int]

Converts a digit character to its integer value (0-9). Returns None if c is not a digit.

fn from_digit(n: int): option.Option[char]

Converts an integer (0-9) to its digit character. Returns None if n is out of range.

fn hex_to_digit(c: char): option.Option[int]

Converts a hexadecimal digit character to its integer value (0-15). Returns None if c is not a hex digit.

fn octal_to_digit(c: char): option.Option[int]

Converts an octal digit character to its integer value (0-7). Returns None if c is not an octal digit.

fn from_hex_digit(n: int): option.Option[char]

Converts an integer (0-15) to its hex digit character (lowercase). Returns None if n is out of range.


Generated by reefc doc