lu.conv

This module contains functions that in one way or another converts its arguments into something else.

Credit for Enum goes to Stephan Koch (https://github.com/UplinkCoder).

Members

Functions

enumToString
auto enumToString(E value)

Convenience wrapper around Enum that infers the type of the passed enum member.

numFromHex
auto numFromHex(string hex, bool acceptLowercase)

Returns the decimal value of a hex number in string form.

rgbFromHex
auto rgbFromHex(string hexString, bool acceptLowercase)

Convenience wrapper that takes a hex string and populates a Voldemort struct with its RR, GG and BB components.

toAlpha
string toAlpha(Num num)

Translates an integer into an alphanumeric string. Assumes ASCII. Overload that returns the string.

toAlphaInto
void toAlphaInto(Num num, Sink sink)

Translates an integer into an alphanumeric string. Assumes ASCII. Overload that takes an output range sink.

Templates

Enum
template Enum(E)

Template housing optimised functions to get the string name of an enum member, or the enum member of a name string.

Examples

enum SomeEnum { one, two, three };

SomeEnum foo = Enum!SomeEnum.fromString("one");
SomeEnum bar = Enum!SomeEnum.fromString("three");

assert(foo == SomeEnum.one);
assert(bar == SomeEnum.three);

Meta