← Back to the index

Module std/char.vv

The char module provides utilities for working with characters. Characters are typically represented by single quotes.

Example:

import char from "std/char.vv"

let u = char.to_upper('a') // 'A'
let d = char.is_digit('1') // true

Table of Contents

Exports

fun to_upper(c) extern "native"

Converts a character to its uppercase equivalent.

Example:

let a = char.to_upper('a') // 'A'
let b = char.to_upper('1') // '1'

fun to_lower(c) extern "native"

Converts a character to its lowercase equivalent.

Example:

let a = char.to_lower('A') // 'a'
let b = char.to_lower('!') // '!'

fun is_digit(c) extern "native"

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

Example:

let d = char.is_digit('5') // true
let e = char.is_digit('a') // false

fun is_space(c) extern "native"

Checks if a character is a whitespace character (e.g., space, tab, newline).

Example:

let a = char.is_space(' ')  // true
let b = char.is_space('\n') // true
let c = char.is_space('a')  // false