我有一個數組中的大量字符串元素列表 ,我正在使用包含函數來檢查它是否包含該元素。它工作正常。現在我想知道元素的索引/位置。 假設陣列是如何從vb.net中的數組中包含函數的元素索引
dim s as string() = {"first", "second","third"}
和字符串
dim l as string = "third"
方法
dim b as boolean = s.Contains(l, StringComparer.CurrentCultureIgnoreCase)
標誌
if (b) Then
messagebox.show("It exists")
end if
上述陣列僅僅是一個例子。原始數組由7690個條目組成,每個條目使用utf-8編寫,而indexOf函數沒有給出任何結果
如果陣列包含您的字符串,它也應該能夠給你字符串的索引。 – Eminem 2015-04-06 12:12:49