Results 1 to 6 of 6

Most efficient way to find string in array members

Threaded View

  1. #1
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Most efficient way to find string in array members

    Hi

    I'm wondering what the most efficient way to find out if a string is in an array.

    For example, lets say I have an array of:
    arr(0) = "me"
    arr(1) = "you"
    arr(2) = "them"
    arr(3) = "no one"

    I want to find out if "anyone" is in the array. I know I could loop through each element and compare the two strings. Is there a better way?
    Last edited by davegugg; 07-06-2010 at 12:08 PM.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1