Page 1 of 1
Improve autocasting of numeric values in strings
Posted: Fri Mar 01, 2013 1:09 pm
by c4s
Works as expected with PB 5.10:
Code: Select all
str$ = "1" + 2
Debug str$ ; Output is "12", great! :)
...should work as well as the compiler
knows that we are working with a string:
Code: Select all
str$ = 1 + "2"
Debug str$ ; Output should be "12"
Re: Improve autocasting of numeric values in strings
Posted: Fri Mar 01, 2013 3:11 pm
by Puffolino
Would also be fine to allow to set user defined casts, like {string}, {integer}, {double} etc.
Code: Select all
s.s="2"
debug {integer} Val( {string} 1 + "." + s ) / 3
Re: Improve autocasting of numeric values in strings
Posted: Fri Mar 01, 2013 6:53 pm
by c4s
...well, that's not part of
my feature request though.

Re: Improve autocasting of numeric values in strings
Posted: Fri Mar 01, 2013 7:12 pm
by Little John
c4s wrote:Works as expected with PB 5.10:
Code: Select all
str$ = "1" + 2
Debug str$ ; Output is "12", great! :)
...should work as well as the compiler
knows that we are working with a string:
Code: Select all
str$ = 1 + "2"
Debug str$ ; Output should be "12"
+ 1
Re: Improve autocasting of numeric values in strings
Posted: Fri Mar 01, 2013 7:16 pm
by ts-soft
and the same for other types like:
Code: Select all
value.i = 1 + "2"
Debug value ; Output should be 3
value.i = "1" + 2
Debug value ; Output should be 3
