mutils.conv

Module to replace std.conv 'to' function with similar but @nogc Function in this module use TLS buffer to store string result, so returned strings are valid only to next usage of X->string conversion functions

Members

Functions

bool2str
string bool2str(T bbb, char[] buff)

//////////////////// Convert bools Converts bool to string

del2str
string del2str(FROM from, char[] buff)

//////////////////// Convert delegates and functions

enum2str
string enum2str(T en, char[] buff)

//////////////////// Convert enums Converts enum to string If wrong enum value is specified "WrongEnum" string is returned

getSpecifier
string getSpecifier()
Undocumented in source. Be warned that the author may not have intended to support it.
min
auto min(A a, B b)
Undocumented in source. Be warned that the author may not have intended to support it.
num2str
string num2str(FROM from, char[] buff)

//////////////////// Convert numbers Converts number of type NUM to string and stores it in buff Internally uses snprintf, string might be cut down to fit in buffer To check for buffer overflow you might compare length of buff and returned string, if they are equal there might be not enought space in buffer NULL char is always added at the end of the string

parse
TO parse(string from)

Converts part of from string to TO variable

slice2str
string slice2str(T slice, char[] buff)

//////////////////// Convert slices Converts slice to string Uses to!(string)(el, buff) to convert inner elements If buff.length<=5 null is returned If there is not enought space in the buffer, function converts as much as it coud with string "...]" at the end

snprintf
int snprintf(char* s, size_t n, char* format, ...)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
sscanf
int sscanf(char* s, char* format, ...)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
str2enum
T str2enum(string str)

Converts string to enum If wrong string is specified max enum base type is returned ex. for: enum:ubyte E{} will return 255

str2num
NUM str2num(string from)

Converts string to numeric type NUM If string is malformed NUM.init is returned

str2struct
T str2struct(string str)

Converts string to struct string format is very strict, returns 0 initialized variable if string is bad Works like struct2str but opposite

struct2str
string struct2str(T s, char[] buff)

//////////////////// Convert structs Converts structs to strings Function is not using to!string so inner elements might be displayed differently ex. enums (they are displayeed as numbers) Elements which cannot be converted are skipped

to
TO to(FROM from)

Converts variable from to Type TO strings are stored in default global buffer

to
TO to(FROM from, char[] buff)

Converts variable from to Type TO strings are stored in buff buffer

Static variables

gTmpStrBuff
char[1024] gTmpStrBuff;
Undocumented in source.

Meta