CharacterClassification
Classifies the fixed Unicode White_Space scalar set without locale state.
Module std.text
import std.text;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
fn
pub const fn IsWhitespace(Value: char) -> boolClassifies the fixed Unicode White_Space scalar set without locale state. Value: One valid Unicode scalar. Return: True for the documented whitespace set; false for BOM/zero-width space.
Example
module example.text_characters;
from std.text import IsWhitespace, IsAsciiWhitespace, ToAsciiLower, ToAsciiUpper;
fn Main() -> i32 {
if !IsWhitespace('\u{2003}') || IsAsciiWhitespace('\u{2003}') { return 1; }
if !IsAsciiWhitespace('\t') || IsWhitespace('\u{200B}') { return 2; }
if ToAsciiLower('Z') != 'z' || ToAsciiUpper('a') != 'A' { return 3; }
if ToAsciiLower('λ') != 'λ' || ToAsciiUpper('λ') != 'λ' { return 4; }
return 0;
}fn
pub const fn IsAsciiWhitespace(Value: char) -> boolClassifies only ASCII tab/newline controls and space. Value: Valid scalar; non-ASCII values always return false. Return: True for U+0009 through U+000D or U+0020, with no allocation.
fn
pub const fn ToAsciiLower(Value: char) -> charConverts an ASCII uppercase letter to lowercase, leaving other scalars unchanged. Value: One valid scalar; Unicode case folding is not performed. Return: Mapped scalar by value, without storage or locale access.
fn
pub const fn ToAsciiUpper(Value: char) -> charConverts an ASCII lowercase letter to uppercase, leaving other scalars unchanged. Value: One valid scalar; Unicode case folding is not performed. Return: Mapped scalar by value, without storage or locale access.