- Comments
- D
- Search
- Home

Last update Sun Jul 1 11:16:37 2007

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

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