Results 1 to 8 of 8

Thread: find an element in array?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    find an element in array?

    Is there a function that searches for a string in an array of strings and returns the index of the element? like instr but for arrays
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Tygur
    Guest
    How about Array.IndexOf? This will show "4" in a message box:
    Code:
    Dim StringArray() As String = {"zero", "one", "two", "three", "four", "five", "six"}
    MsgBox(Array.IndexOf(StringArray, "four"))

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    tnx
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    actually, it doesnt work for what I want. For example if I have a string array and I want to search for a partial search it wont work, it only looks for an exact match
    so do I have to write my own func if I want to do a paritial search?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5
    Member EagleEye's Avatar
    Join Date
    May 2002
    Location
    South Carolina, USA
    Posts
    43
    Mr. Polite,

    Did you ever figure out how to do this?
    Eagle Eye

    "Programming is easy ... when you are done."

  6. #6
    Lively Member
    Join Date
    May 2002
    Posts
    94
    Dim StringArray() As String = {"zero", "one", "two", "three", "four", "five", "six"}
    MsgBox(StringArray.contains("four"))

    Can't test this cause I'm not at a dev box, but that will work for a combobox so it should work for a array.

    let me know if I'm right.

    -Thankx

  7. #7
    Member
    Join Date
    Dec 2002
    Location
    NY, USA
    Posts
    52
    Originally posted by Evad
    Dim StringArray() As String = {"zero", "one", "two", "three", "four", "five", "six"}
    MsgBox(StringArray.contains("four"))

    Can't test this cause I'm not at a dev box, but that will work for a combobox so it should work for a array.

    let me know if I'm right.

    -Thankx
    Array does not have such property contains.
    What is that?
    Iouri Boutchkine

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    maybe he meant indexof

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