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#
| Name | Description |
|---|---|
is_space | True for ASCII space, tab, line feed, or carriage return. |
is_digit | True for an ASCII decimal digit (0 through 9). |
is_hex | True for an ASCII hex digit (0-9, a-f, A-F). |
is_alpha | True for an ASCII letter (A through Z or a through z). |
is_alnum | True for an ASCII alphanumeric byte. |
is_print | True for an ASCII printable byte (space through tilde). |
is_ctrl | True for an ASCII control byte (below space, excluding DEL). |
to_lower | ASCII lower-case for A..=Z; other bytes unchanged. |
to_upper | ASCII upper-case for a..=z; other bytes unchanged. |
digit_val | Numeric value of an ASCII decimal digit, or -1 for another byte. |
hex_val | Numeric value of an ASCII hex digit, or -1 for another byte. |
hex_digit | Lowercase hex digit for 0..=15. |
digit_char | Decimal digit as a one-byte string. |