[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Datatype Conversion
At 6:48 AM 1/12/96, Lourdes Yero wrote:
>This example work fine with netscape 2.0beta4
>With Netscape 2.0beta5 DON'T WORK !!!!
> total = 0 + form.ent1.value + form.trav1.value
behavior to Java behavior; there's a separate way to handle this case which
is backwards compatible with 2.0b4 (and 2.0b3).
Here's the relevant discussion of this by Brendan Eich:
>decided to make an incompatible change: formerly, you could convert from a
>string containing a numeric literal (possibly with leading and trailing
>white space) to a number by saying '0 + str'.
>But that's incompatible with Java's overloading of the + operator for string
>concatenation: in Java, '0 + str' where str contains "123" should produce
>"0123", a string. That's how Java behaves, and in 2.0b5 that is also how
>need to change all '0 + str' conversions to 'parseFloat(str)'.
>If you want to convert an integral numeric literal string, you can call
>'parseInt(str[, radix])' where the radix argument (optional in 2.0b5) is 0
>for C-like rules (leading "0x" => hex, leading "0" => octal, else decimal)
>or the base to use when converting digits.
Hope this helps.
Frank Hecker Pre-sales tech support, Netscape field sales group