Module coil-stdlib

ascii

Functions here take and return byte. Bytes outside ASCII are never letters or digits, and case conversion leaves them unchanged. For whole strings, see text.

Part of coil-stdlib. spool projects get it automatically; with plain coil, pass --root ~/.coil/stdlib/src.

Import what you use (use path::* is not allowed):

use ascii::{is_space, is_digit};

Functions#

NameDescription
is_spaceTrue for ASCII space, tab, line feed, or carriage return.
is_digitTrue for an ASCII decimal digit (0 through 9).
is_hexTrue for an ASCII hex digit (0-9, a-f, A-F).
is_alphaTrue for an ASCII letter (A through Z or a through z).
is_alnumTrue for an ASCII alphanumeric byte.
is_printTrue for an ASCII printable byte (space through tilde).
is_ctrlTrue for an ASCII control byte (below space, excluding DEL).
to_lowerASCII lower-case for A..=Z; other bytes unchanged.
to_upperASCII upper-case for a..=z; other bytes unchanged.
digit_valNumeric value of an ASCII decimal digit, or -1 for another byte.
hex_valNumeric value of an ASCII hex digit, or -1 for another byte.
hex_digitLowercase hex digit for 0..=15.
digit_charDecimal digit as a one-byte string.
↑ ↓ navigate ↵ open