Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

CharacterClassification

Classifies the fixed Unicode White_Space scalar set without locale state.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

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) -> bool

Classifies 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) -> bool

Classifies 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) -> char

Converts 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) -> char

Converts 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.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library