我有一个数组中的大量字符串元素列表 ,我正在使用包含函数来检查它是否包含该元素。它工作正常。现在我想知道元素的索引/位置。 假设阵列是如何从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