D Programming Language 1.0

- Comments
- D
- Search
- Home

Last update Fri Dec 17 09:40:22 2010

# 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
        UnsignedInteger

    Sign:
        +
        -

For conversion to signed types, the grammar recognized is:

    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(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.

Copyright © 1999-2010 by Digital Mars, All Rights Reserved | Page generated by Ddoc.