utils.misc

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

Public Imports

utils.ds
public import utils.ds : ByteUnion;

Members

Aliases

ByteUnion
alias ByteUnion = utils.ds.ByteUnion

used to read data as array of bytes

integer
alias integer = ptrdiff_t

integer is a long on 64 bit systems, and int` on 32 bit systems

uinteger
alias uinteger = size_t

uinteger is a ulong on 64 bit systems, and uint on 32 bit systems

Functions

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

Writes an array of string to a file

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

Returns index of closing/openinig bracket of the provided bracket

deleteElement
T[] deleteElement(T[] dat, uinteger pos, uinteger count)

Removes a number of elements starting from an index

divideArray
T[][] divideArray(T[] array, uinteger 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
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
bool hasElement(T[] array, T element)
hasElement
bool hasElement(T[] array, T[] elements)
indexOf
integer indexOf(T[] array, T element)
insertElement
T[] insertElement(T[] dat, T[] toInsert, uinteger pos)

Inserts an array into another array, at a provided index

insertElement
T[] insertElement(T[] dat, T toInsert, uinteger pos)

Inserts an element into an array

isAlphabet
bool isAlphabet(string s)
isNum
bool isNum(string s, bool allowDecimalPoint)
listDir
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.

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

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

reverseArray
T[] reverseArray(T[] s)
sortAscending
bool sortAscending(T[] array)

Sorts an array, in ascending order, containing floating point, or integers

sortAscendingIndex
uinteger[] sortAscendingIndex(T[] array)

Sorts an array in ascending order

Meta