Quote:
Originally Posted by agraham
Sorry, the perils of haste  , dinner was ready to serve! The above is wrong, it should be
Code:
If index < 0 then index = 0 - 1 - index ' complement End If
so
0xffff (-1) => 0
0xfffe (-2) => 1
0cfffd (-3) => 2
etc.
|
Thanks again Andrew. It would be nice to have this explained in the Help, but maybe it is not worth doing that now it is enshrined in this relevant thread.
None of the above explains why I am getting zero returned from BinarySearch() whereas IndexOf() gives the results I expect and works fine. The demo program works OK if tweaked to look for missing values. BTW I think that the constants are singular as in the Help, not cNumber
s. I suppose if you have the detection suppressed this means you will get a null string or zero passed to the operation instead of the intended constant, which could give strange results.
My look-up arrays are generated by sparsely storing a counter, so are sorted numerically from the outset; I do not perform a sort operation. If you wanted(?) to investigate I could write out a sample array. (It is derived from zooming an OS-GB vector road-map.)
Mike.