Strange..., why '@' ?
PS: Ali Çehreli, thanks for your book, your book is wonderful!!!
On Tuesday, 15 July 2014 at 13:49:51 UTC, Ali Çehreli wrote:
On 07/15/2014 04:56 AM, Alexandre wrote:
> retVal = to!int(val);
> std.conv.ConvException@C:\D\dmd2\src\phobos\std\conv.d(1968):
Unexpected
> '@' when converting from type string to type int
That means to!int failed because 'val' contained a '@'
character in it:
import std.conv;
void main()
{
auto s = "42@"; // <-- What is that?
auto i = to!int(s);
}
However, there seems to be a bug in to(). It seems to
incorrectly go one character ahead:
to!int("mn");
"Unexpected 'n' when converting from type string to type int"
to!int("m");
"Unexpected end of input when converting from type string to
type int"
That is a bug, right?
So, in your case the unexpected '@' character may be after
another unexpected one:
to!int(" @");
"Unexpected '@' when converting from type string to type int"
Ali