std.ascii
Functions which operate on ASCII characters.
All of the functions in std.ascii accept Unicode characters but effectively ignore them if they're not ASCII. All isX functions return false for non-ASCII characters, and all toX functions do nothing to non-ASCII characters.
For functions which operate on Unicode characters, see
std.uni.
References:
ASCII Table, WikipediaLicense
Types 2
enumLetterCase : bool
Letter case specifier.
upperUpper case letters
lowerLower case letters
enumControlChar : char
All control characters in the ASCII table (source).
nul = '\x00'Null
soh = '\x01'Start of heading
stx = '\x02'Start of text
etx = '\x03'End of text
eot = '\x04'End of transmission
enq = '\x05'Enquiry
ack = '\x06'Acknowledge
bel = '\x07'Bell
bs = '\x08'Backspace
tab = '\x09'Horizontal tab
lf = '\x0A'NL line feed, new line
vt = '\x0B'Vertical tab
ff = '\x0C'NP form feed, new page
cr = '\x0D'Carriage return
so = '\x0E'Shift out
si = '\x0F'Shift in
dle = '\x10'Data link escape
dc1 = '\x11'Device control 1
dc2 = '\x12'Device control 2
dc3 = '\x13'Device control 3
dc4 = '\x14'Device control 4
nak = '\x15'Negative acknowledge
syn = '\x16'Synchronous idle
etb = '\x17'End of transmission block
can = '\x18'Cancel
em = '\x19'End of medium
sub = '\x1A'Substitute
esc = '\x1B'Escape
fs = '\x1C'File separator
gs = '\x1D'Group separator
rs = '\x1E'Record separator
us = '\x1F'Unit separator
del = '\x7F'Delete
Functions 15
fn
bool isAlphaNum(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a letter or a number (0 .. 9, a .. z, A .. Z).fn
bool isAlpha(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is an ASCII letter (A .. Z, a .. z).fn
bool isLower(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a lowercase ASCII letter (a .. z).fn
bool isUpper(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is an uppercase ASCII letter (A .. Z).fn
bool isDigit(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a digit (0 .. 9).fn
bool isOctalDigit(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a digit in base 8 (0 .. 7).fn
bool isHexDigit(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a digit in base 16 (0 .. 9, A .. F, a .. f).fn
bool isWhite(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether or not `c` is a whitespace character. That includes the space, tab, vertical tab, form feed, carriage return, and linefeed characters.fn
bool isControl(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a control character.fn
bool isPunctuation(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether or not `c` is a punctuation character. That includes all ASCII characters which are not control characters, letters, digits, or whitespace.fn
bool isGraphical(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether or not `c` is a printable character other than the space character.fn
bool isPrintable(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether or not `c` is a printable character - including the space character.fn
bool isASCII(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether or not `c` is in the ASCII character set - i.e. in the range 0 .. 0x7F.Variables 9
var
"0123456789ABCDEFabcdef" fullHexDigits0 .. 9A .. Fa .. f
var
fullHexDigits[0 .. 16] hexDigits0 .. 9A .. F
var
"0123456789abcdef" lowerHexDigits0 .. 9a .. f
var
hexDigits[0 .. 10] digits0 .. 9
var
digits[0 .. 8] octalDigits0 .. 7
var
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" lettersA .. Za .. z
var
letters[0 .. 26] uppercaseA .. Z
var
letters[26 .. 52] lowercasea .. z
var
" \t\v\r\n\f" whitespaceASCII _whitespace