utils.misc

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

Members

Aliases

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 Throws exception on failure

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

Removes element(s) from an array, and returns the modified array;

fileToArray
string[] fileToArray(string fname)

Reads a file into an array of string Throws exception on failure

hasElement
bool hasElement(T[] array, T element)

Returns true if an aray has an element, false if no

hasElement
bool hasElement(T[] array, T[] elements)

Returns true if array contains all elements provided in an array, else, false

indexOf
integer indexOf(T[] array, T element)

Returns the index of an element in an array, negative one if not found

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

Inserts an array into another array, returns the result;

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

Inserts an element into an array

isAlphabet
bool isAlphabet(string s)

returns true if all characters in a string are alphabets, uppercase, lowercase, or both

isNum
bool isNum(string s)

Returns true if a string is a number, with a decimal point, or without

lowercase
string lowercase(string s)

Returns a string with all uppercase alphabets converted into lowercase

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

generates a markdown table for some data.

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

Returns true if all elements in array match with another array's elements. Index, and the number of times the element is present in each array doesn't matter

reverseArray
T[] reverseArray(T[] s)

returns the reverse of an array

Meta