ascii +linux +x86_64

The ascii module provides helper functions for working with the subset of Unicode which is defined by the American Standard Code for Information Interchange (ASCII).

Index

Functions

fn isalnum(rune) bool;
fn isalpha(rune) bool;
fn isblank(rune) bool;
fn iscntrl(rune) bool;
fn isdigit(rune) bool;
fn isgraph(rune) bool;
fn islower(rune) bool;
fn isprint(rune) bool;
fn ispunct(rune) bool;
fn isspace(rune) bool;
fn isupper(rune) bool;
fn isxdigit(rune) bool;
fn strcasecmp(str, str) int;
fn tolower(rune) rune;
fn toupper(rune) rune;
fn valid(rune) bool;
fn validstr(str) bool;

Functions

fn isalnum[link]

fn isalnum(c: rune) bool;

Returns true if an ASCII character is alphanumeric.

fn isalpha[link]

fn isalpha(c: rune) bool;

Returns true if an ASCII character is a letter.

fn isblank[link]

fn isblank(c: rune) bool;

Returns true if a rune is a space or a tab.

fn iscntrl[link]

fn iscntrl(c: rune) bool;

Returns true if an ASCII character is a control character.

fn isdigit[link]

fn isdigit(c: rune) bool;

Returns true if an ASCII character is a digit.

fn isgraph[link]

fn isgraph(c: rune) bool;

Returns true if an ASCII character is any printable character other than space.

fn islower[link]

fn islower(c: rune) bool;

Returns true if an ASCII character is lowercase.

fn isprint[link]

fn isprint(c: rune) bool;

Returns true if an ASCII character is printable.

fn ispunct[link]

fn ispunct(c: rune) bool;

Returns true if an ASCII character is punctuation.

fn isspace[link]

fn isspace(c: rune) bool;

Returns true if an ASCII character is a white-space character - one of '\f', '\n', '\r', '\t', '\v', ' '.

fn isupper[link]

fn isupper(c: rune) bool;

Returns true if an ASCII character is uppercase.

fn isxdigit[link]

fn isxdigit(c: rune) bool;

Returns true if an ASCII character is a hexadecimal digit.

fn strcasecmp[link]

fn strcasecmp(a: str, b: str) int;

Compares two strings by their ASCII sort order, treating all capital letters as their lowercase counterpart (i.e. a case-insensitive comparison is performed). Zero is returned if the strings are equal, a negative value if a is less than b, or a positive value if a is greater than b. Aborts if a non-ASCII byte is encountered.

fn tolower[link]

fn tolower(c: rune) rune;

Returns the lowercase form of an ASCII character, or the original character if it was not an uppercase letter (or was not ASCII).

fn toupper[link]

fn toupper(c: rune) rune;

Returns the uppercase form of an ASCII character, or the original character if it was not a lowercase letter (or was not ASCII).

fn valid[link]

fn valid(c: rune) bool;

Returns true if a rune is a valid ASCII character.

fn validstr[link]

fn validstr(s: str) bool;

Returns true if all runes in a string are valid ASCII characters.