On Wednesday, 21 October 2020 at 22:50:27 UTC, matheus wrote:
Hi,

import std.stdio, std.conv;
void main(string[ ] args) {
    auto a = (1).to!int;     // this works
    auto b = ("1").to!int;   // this works
    auto c = (1.1).to!int;   // this works and c = 1
    auto d = ("1.1").to!int; // Doesn't work
}

[...]

1.1 is not int.
"to" works fine.

As solution,... "1.1" should be splitted to lexems: "1", ".", "1". Then analyze and then converted to int.

Reply via email to