Results 1 to 5 of 5

Thread: Quick string search methods?

  1. #1

    Thread Starter
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Quick string search methods?

    I've been searching around hoping to find a progressive searching method, but with no luck.
    What I am interested in is if there is a more progressive search method then a For Next loop?

    For example, lets say I listed all the files on my C drive. To search for a file I do a For Next loop through the list and compare my filename to the data in the list. And that is ok if you want just that one pass.
    But what happens if I have to search for a 100 or more file names? The number of passes becomes 100 * ListCount and that gets pretty slow.

    Anyone have or heard of any other (faster) methodologies?

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Quick string search methods?

    What if all the fileNames are loaded into a ListBox, and you use the SendMessage API with the FINDSTRINGEXACT param:

    SendMessage(List1.hwnd, LB_FINDSTRINGEXACT, 0&, ByVal sFind) - that would be quicker than a For Next.

  3. #3

    Thread Starter
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Quick string search methods?

    Could that be used with the ListView? Because, ListBox is limited to just over 32.000 items which is not sufficient in my case.

  4. #4
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Quick string search methods?

    Probably.

    I did a test with a ListBox containing 32,000 items, and searched for 33 items.

    The For Next took approx 3 Seconds, whereas the SendMessage took less than .5 second

  5. #5

    Thread Starter
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Quick string search methods?

    I will test it with a ListView and post the results. Thanks.

    If anyone else has other suggestions feel free to post them

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width