ascii+x86_64 +linux

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(c: rune) bool;
fn isalpha(c: rune) bool;
fn isblank(c: rune) bool;
fn iscntrl(c: rune) bool;
fn isdigit(c: rune) bool;
fn isgraph(c: rune) bool;
fn islower(c: rune) bool;
fn isprint(c: rune) bool;
fn ispunct(c: rune) bool;
fn isspace(c: rune) bool;
fn isupper(c: rune) bool;
fn isxdigit(c: rune) bool;
fn strcasecmp(a: str, b: str) int;
fn strlower(s: str) str;
fn strlower_buf(s: str, buf: []u8) str;
fn strupper(s: str) str;
fn strupper_buf(s: str, buf: []u8) str;
fn tolower(c: rune) rune;
fn toupper(c: rune) rune;
fn valid(c: rune) bool;
fn validstr(s: 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 sort order, treating all ASCII capital letters as their lowercase counterpart (i.e. an ASCII-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.

fn strlower[link]

fn strlower(s: str) str;

Converts all ASCII uppercase characters in a string to their lowercase representation, returning a new string. The return value must be freed by the caller.

fn strlower_buf[link]

fn strlower_buf(s: str, buf: []u8) str;

Converts all ASCII uppercase characters in a string to their lowercase representation, returning a new string. The new string data is stored in the supplied buffer (overwriting any existing contents). The buffer is permitted to exactly overlap the string. This function will abort if the buffer's capacity is too small to fit the entire string.

fn strupper[link]

fn strupper(s: str) str;

Converts all ASCII lowercase characters in a string to their uppercase representation, returning a new string. The return value must be freed by the caller.

fn strupper_buf[link]

fn strupper_buf(s: str, buf: []u8) str;

Converts all ASCII lowercase characters in a string to their uppercase representation, returning a new string. The new string data is stored in the supplied buffer (overwriting any existing contents). The buffer is permitted to exactly overlap the string. This function will abort if the buffer's capacity is too small to fit the entire string.

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.