Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
0.2.0 Preview 1 · Frozen documentation

CharacterClassification

Classifies the fixed Unicode White_Space scalar set without locale state.

Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. 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