【发布时间】:2015-04-06 12:00:54
【问题描述】:
我有一个数组中大量字符串元素的列表 我正在使用 contains 函数来检查它是否包含该元素。它工作正常。现在我想知道元素的索引/位置。 假设数组是
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 函数没有给出任何结果
【问题讨论】:
-
如果数组确实包含你的字符串,它也应该能够给你字符串的索引。