× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Obscure indeed. Great call Joe, that clears up a lot of confusion! I'll have
to notify the script author.

Thanks.


message: 8
date: Tue, 9 Aug 2005 22:05:48 -0500
from: "Joe Pluta" <joepluta@xxxxxxxxxxxxxxxxx>
subject: RE: [WDSCI-L] Possible bug in WDSc support for java script?

It is possible that the parseInt routine is using the rather obscure
concept that numbers starting with a "0" digit are supposed to be octal.
To test this, you might try parsing "010" and see if you get ten or
eight.

Ah heck, I'll do it myself... (pause for a quick test) ...and yes, it
seems to be the case!

var s = "07";
alert(s + " = " + parseInt(s));
s = "08";
alert(s + " = " + parseInt(s));
s = "10";
alert(s + " = " + parseInt(s));
s = "010";
alert(s + " = " + parseInt(s));

I get the following:

07 = 7
08 = 0
10 = 10
010 = 8

Gotta love octal.  So, in order to parse properly, you have to remove
any leading zeros.

Joe

> From: Cromar, Graham
> 
> Turns out, the only values that don't parse properly (in the range 1 -
31)
> are '08' and '09' which result in num being zero. '01' thru '07'
result in
> a 1 and 7 respectively.



------------------------------

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.