utils.misc

This module contains contains some misc. functions. (The name says that)

Members

Functions

arrayToFile
void arrayToFile(string[] array, string fname, string toApp)

Writes an array of string to a file

bench
Times bench(void delegate(ref StopWatch sw) func, ulong runs)
Undocumented in source. Be warned that the author may not have intended to support it.
bench
Times bench(void delegate() func, ulong runs)
Undocumented in source. Be warned that the author may not have intended to support it.
bitmaskToString
string bitmaskToString(ulong flags)

Converts bitflags to comma separated readable string for enums T is an enum, with ulong base type

bracketPos
size_t bracketPos(T[] s, size_t index, T[] opening, T[] closing)

Returns index of closing/openinig bracket of the provided bracket

combinations
ulong[] combinations(ulong alwaysIncluded, ulong alwaysExcluded)

Generates combinations for enum with bitflag members T, the enum, must have base type as ulong

divideArray
T[][] divideArray(T[] array, size_t maxLength)

Divides an array into smaller arrays, where smaller arrays have a max size

fileToArray
string[] fileToArray(string fname)

Reads a file into array of string

filesModified
deprecated string[] filesModified(string filePath, SysTime lastTime, string[] exclude)

uses listdir to list files/dirs in a dir, and filters the ones that were modified after a given time

hasElement
deprecated bool hasElement(T[] array, T element)
hasElement
bool hasElement(T[] array, T[] elements)
indexOf
ptrdiff_t indexOf(T[] array, T element)
isAlphabet
bool isAlphabet(string s)
isNum
bool isNum(string s, bool allowDecimalPoint)
listDir
deprecated string[] listDir(string pathname)

lists the files and dirs inside a dir

lowercase
string lowercase(string s)
makeTable
string[] makeTable(string[] headings, T[][] data)

generates a markdown table for some data.

mangle
size_t mangle(size_t val, size_t key)

mangles an unsigned integer, using a key. is reversible. calling this on a mangled integer will un-mangle it

mangle
size_t mangle(size_t val)

mangles using a key available at compile time. is reversible, calling mangled integer with same key will return un-mangled integer

matchElements
bool matchElements(T[] toMatch, T[] elements)

Checks if all elements present in an array are also present in another array

readBinary
size_t readBinary(string str)

Reads a binary number from string

readHexadecimal
size_t readHexadecimal(string str)

Reads a hexadecimal number from string

Structs

Times
struct Times
Undocumented in source.

Unions

ByteUnion (from utils.ds)
union ByteUnion(T) via public import utils.ds : ByteUnion;

Used to read some data type as ubyte[x]

Meta