Results 1 to 3 of 3

Thread: InStr function is useful; do we have an equivalent for arrays?

  1. #1
    Guest

    Post

    MyStr = "abcde"
    msgbox InStr(MyStr,"c")

    I'll get a message "3" 'cause c is in 3rd position in MyStr string

    do we have a function
    If I got an array MyArr(0) = "a" etc...

    thanks


  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    I don't knonw if there is a function but you could build one.

    dim strTemp() as string, intI as integer

    redim strTemp(4)

    for inti = 0 to 4
    if strtemp(inti) = "a" then
    msgobx "This array location:" & inti, vbokonly, "Array location"
    exit for
    end if
    next inti

  3. #3
    Guest

    Post

    sure but looping is always slower than using built in functions

    thanks anyway

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