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, Wikipedia

License

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

fnbool 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).
fnbool isAlpha(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is an ASCII letter (A .. Z, a .. z).
fnbool isLower(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a lowercase ASCII letter (a .. z).
fnbool isUpper(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is an uppercase ASCII letter (A .. Z).
fnbool isDigit(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a digit (0 .. 9).
fnbool isOctalDigit(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a digit in base 8 (0 .. 7).
fnbool 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).
fnbool 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.
fnbool isControl(dchar c) @safe pure nothrow @nogcParams: c = The character to test. Returns: Whether `c` is a control character.
fnbool 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.
fnbool 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.
fnbool 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.
fnbool 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.
fnauto toLower(C)(C c) if (is(C : dchar))Converts an ASCII letter to lowercase.
fnauto toUpper(C)(C c) if (is(C : dchar))Converts an ASCII letter to uppercase.

Variables 9

var"0123456789ABCDEFabcdef" fullHexDigits

0 .. 9A .. Fa .. f

varfullHexDigits[0 .. 16] hexDigits

0 .. 9A .. F

var"0123456789abcdef" lowerHexDigits

0 .. 9a .. f

varhexDigits[0 .. 10] digits

0 .. 9

vardigits[0 .. 8] octalDigits

0 .. 7

var"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" letters

A .. Za .. z

varletters[0 .. 26] uppercase

A .. Z

varletters[26 .. 52] lowercase

a .. z

var" \t\v\r\n\f" whitespace

ASCII _whitespace