D Documentation  
atoi
long atoi(char[] s)

This function converts a string of to a long integer.

If s is not convertable (for example if s=="a"), atoi should create a StringException, but it does not!
Note: atoi returns zero or the first part of numbers it could convert.

Example:
try {
  writefln(atoi(cast(char[])"55"));
} catch {
  writefln("Exception with '55'");
}
try {
  writefln(atoi(cast(char[])"55a"));
} catch {
  writefln("Exception with '55a'");
}
try {
  writefln(atoi(cast(char[])"z"));
} catch {
  writefln("Exception with 'z'");
}


Output:
55
55
0


See also:
Try statements, atof, toString
Created using PHP docwiki written by Markus Dangl. Best viewed with Mozilla Firefox.