Question about: ("1.1").to!int;
matheus
matheus at gmail.com
Sat Oct 24 14:10:02 UTC 2020
On Saturday, 24 October 2020 at 04:04:18 UTC, Виталий Фадеев
wrote:
> On Friday, 23 October 2020 at 16:59:06 UTC, matheus wrote:
>> On Friday, 23 October 2020 at 13:57:41 UTC, Joseph Rushton
>> Wakeling wrote:
>>> On Wednesday, 21 October 2020 at 22:50:27 UTC, matheus wrote:
>> Well since the caller is handling a string, shouldn't the
>> caller verify the content before any conversion?
>
> What if:
> "1.1.1".to!int
> ?
>
> The algorithm will become more complicated?
> Will the speed decrease?
I don't get...
Anyway this should fail, look "1.1" is one thing, "1.1.1" is
another thing as "1.a" is another thing.
Like I said before I think the behavior should be the same in
these cases:
(1.1).to!int = 1.
("1.1").to!int = Current is an error and IMO should be 1.
Now for your question:
1.1.1.to!int = Error: found `0.1` when expecting `,`.
"1.1.1".to!int = Should be the same as above.
Matheus.
More information about the Digitalmars-d-learn
mailing list