ZTree.com  | ZEN  | About...  

 Index   Back

"isAnInteger" batch function flaw   [Q]

By: John Gruener     Orlando, Florida  
Date: Sep 20,2017 at 19:42
In Response to: "isAnInteger" batch function flaw (Nick Williams)

> Yes, you're absolutely right. In my hurry to supply a solution to
> Ryan's problem, I overlooked this. I had even included the "007" and
> "009" tests to remind myself !

I thought it odd that you put that specific test there for that, yet didn't see the error. I fully understand being in a hurry! ;-)

> To correct this, I will need to strip away any leading zeros and test
> against what's left.
>
> But this raises the question as to whether I should consider a number
> that has leading zeros to be an integer, in the first place. I'm not
> sure.
>
> I've always thought of numbers formatted with leading zeros as
> "numeric strings", commonly found as indexes to database tables.

Well, my opinion is that, to be completely accurate, you should consider it an integer. Since the purpose for which the function might be used is not predictable, leading zeros may very well be present in valid integers.

- John

219 views      
Thread locked
 

Messages in this Thread

 
94,489 Postings in 11,923 Threads, 348 registered users, 10 users online (1 registered, 9 guests)
Index | Admin contact |   Forum Time: Oct 21, 2019 - 9:15 pm EDT  |  Hits:28,790,714  (5,382 Today )
RSS Feed