|
I'm trying to force users to select one of a long list of items. (Actually user and Empl ID number.) This is to populate a field in a CSV file that is created by the script. The CSV file, in turn is used to feed a system over which we have no control.
I'm able to parse a file containing the user data into an array. no problem. I'm also able to fill a variable one keystroke at a time. again, not that big a deal. What I'd like to do is conduct a partial match search of the 'master' array from left to right and, when the resultant match set is less than say 10 items, present them as choices to the user to select from.
Seeking the first 'match' (only the leftmost character) is not so bad, but since I can't determine in advance how many matches there will be for the first TWO (then three, four...) characters, how do I initially declare the search result array? I'd think it has to be a size [0] and add as matches are discovered. That way I'd be assured that the size of the resultant array is the number of matches.
OK.. I K.N.O.W this is not an efficient way of doing this, so I'm open to suggestions.
|