Yikes! That's a cool concept that Richard presented.. AScan is a relatively new function that scans an array - Kix Version 4.2 or higher I believe.
Howard also brought up a good point while I was typing my original post.. A good way to get around this is to again use a base length, but use a delimiter.
code:
$Name = 'Tom'
$Names = 'Tommy:Mary :Sally:Peter:John :Tom :'
The baselength is now 6, which includes the delimiter. Searching for 'Tom' would return ID=0 (Tommy) because that's the first match found. The search name must be modified to include the delimiter to provide an exact (and unique) match.
code:
; pad with spaces, trim to 5 chars, add the delim char
$SearchName = Left($Name + ' ', 5) + ':'
Now, 'Tom' becomes 'Tom :', which only matches the 6th entry.
As you can see, there are lots of ways to tackle a problem. Each has it's unique advantages and disadvantages.. sometimes what you use will depend on what you want to get as a result.
Glenn
_________________________
Actually I
am a Rocket Scientist!