by ZippeyKeys12 » Sat Nov 11, 2017 10:57 pm
Code: Select all
const x="12";
int y=x.ToInt();
console.printf("%d",y);
Prints 0
Code: Select all
int y="12".ToInt();
console.printf("%d",y);
Prints 0
But...
Code: Select all
String x="12";
int y=x.ToInt();
console.printf("%d",y);
Prints 12
I don't think this is intended, and while running ToInt() on a literal is pointless, some may want to run it on a constant.
EDIT: Also happens with ToDouble()
[code]const x="12";
int y=x.ToInt();
console.printf("%d",y);[/code]Prints 0
[code]int y="12".ToInt();
console.printf("%d",y);[/code]Prints 0
But...
[code]String x="12";
int y=x.ToInt();
console.printf("%d",y);[/code]Prints 12
I don't think this is intended, and while running ToInt() on a literal is pointless, some may want to run it on a constant.
EDIT: Also happens with ToDouble()