std.conv
Conversion building blocks. These differ from the C equivalents atoi() and atol() by checking for overflow and not allowing whitespace.For conversion to signed types, the grammar recognized is:
Integer: Sign UnsignedInteger UnsignedIntegerFor conversion to signed types, the grammar recognized is:
Sign: + -
UnsignedInteger: DecimalDigit DecimalDigit UnsignedInteger
- class ConvError: object.Error;
- Thrown on conversion errors, which happens on deviation from the grammar.
- class ConvOverflowError: object.Error;
- Thrown on conversion overflow errors.
- int toInt(const(char)[] s);
uint toUint(const(char)[] s);
long toLong(const(char)[] s);
ulong toUlong(const(char)[] s);
short toShort(const(char)[] s);
ushort toUshort(const(char)[] s);
byte toByte(const(char)[] s);
ubyte toUbyte(const(char)[] s);
float toFloat(const char[] s);
double toDouble(const char[] s);
real toReal(const char[] s); - Convert character string to the return type.