ae.utils.text.ascii

Simple (ASCII-only) text-processing functions, for speed and CTFE.

Members

Aliases

ascii
alias ascii = string

Semantic alias for an array of immutable bytes containing some ASCII-based 8-bit character encoding. Might be UTF-8, but not necessarily - thus, is a semantic superset of the D "string" alias.

asciiToLower
alias asciiToLower = xlat!(asciiLower, char)

Mutates buffer in-place

asciiToUpper
alias asciiToUpper = xlat!(asciiUpper, char)
Undocumented in source.

Functions

containsOnlyChars
bool containsOnlyChars(string s, string chars)
Undocumented in source. Be warned that the author may not have intended to support it.
fromDec
T fromDec(string s)

Basic string-to-integer conversion. Doesn't check for overflows.

isSignedInteger
bool isSignedInteger(string s)
Undocumented in source. Be warned that the author may not have intended to support it.
isUnsignedInteger
bool isUnsignedInteger(string s)
Undocumented in source. Be warned that the author may not have intended to support it.
toDec
char[] toDec(N o, char[U] buf)

Writes n as decimal number to buf (right-aligned), returns slice of buf containing result.

toDec
string toDec(T n)

Basic integer-to-string conversion.

toDecCTFE
char[] toDecCTFE(N o, char[U] buf)

CTFE-friendly variant.

toDecFixed
void toDecFixed(N n, char[U] buf)
char[U] toDecFixed(N n)

Print an unsigned integer as a zero-padded, right-aligned decimal number into a buffer

xlat
void xlat(T[] buf)
Undocumented in source. Be warned that the author may not have intended to support it.

Templates

DecimalSize
template DecimalSize(T : ulong)

Maximum number of characters needed to fit the decimal representation of any number of this basic integer type.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>