Patten Matching
Hi all,
I have a String array containging a huge amount of string. when i give a particular pattern for example all strings which starts with letter 'a' then i should be able to retrive all the strings from the array which starts with 'a'.
is there any better way of doing this other than iterating the whole string array
please help
[362 byte] By [
zetaa] at [2007-11-27 3:25:17]

> is there any better way of doing this other than
> iterating the whole string array
>
Unless the strings in the string array have some order that will help in the search you will have to visit each string.
If, for example, the strings were alphabetically ordered then to find all the strings starting with , say, 'p' you would just do a binary search to find one of them and then scan forwards and backwards from that one to find the rest.