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

Thread locked

Messages in this Thread

94,977 Postings in 11,970 Threads, 349 registered users, 33 users online (0 registered, 33 guests)
Index | Admin contact |   Forum Time: May 29, 2020 - 12:24 pm EDT  |  Hits:31,259,876  (4,836 Today )
RSS Feed