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
Source:
std/conv.d
- 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(char[] s);
uint toUint(char[] s);
long toLong(char[] s);
ulong toUlong(char[] s);
short toShort(char[] s);
ushort toUshort(char[] s);
byte toByte(char[] s);
ubyte toUbyte(char[] s);
float toFloat(char[] s);
double toDouble(char[] s);
real toReal(char[] s); - Convert character string to the return type.