How would I find the index of an item in the string array in the following code:
Dim arrayofitems() as String
Dim itemindex as UInteger
itemindex = arrayofitems.IndexOf("item test")
Dim itemname as String = arrayofitems(itemindex)
I'd like to know how I would find the index of an item in a string array. (All of the items are lowercase, so case shouldn't matter.)
It's a static (Shared
) method on the Array
class that accepts the actual array as the first parameter, as:
Dim arrayofitems() As String
Dim itemindex As Int32 = Array.IndexOf(arrayofitems, "item test")
Dim itemname As String = arrayofitems(itemindex)
MSDN page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With