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

Aliases

enumToString
alias enumToString = toString

Compatibility alias to toString.

Functions

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.

toString
auto toString(E value)

Convenience wrapper around Enum.toString that infers the type of the enum to instantiate it with from the passed enum member.

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