如何使用 vb.net 查找字符串列表 [英] How to find list of string using vb.net
本文介绍了如何使用 vb.net 查找字符串列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 vb.net 在文本框中查找字符串列表
How to find list of string in textbox using vb.net
我试试这个代码
Dim x as New List(Of String)
X.Add("a1")
X.Add("a2")
X.Add("a3")
X.Add("a4")
If TextbBox1.Text.Contains(x) Then
'Code'
End If
如何在大字符串中找到大列表(真或假)
How to find big list in big string lees time (true or false )
推荐答案
您可以使用 Any
函数查看 x
的每个值,看看它是否包含在文字:
You can use the Any
function to look at each value of x
and see if it is contained in the text:
Dim sampleText = "x1 y1 z1 a2"
Dim x As New List(Of String) From {"a1", "a2", "a3", "a4"}
If x.Any(Function(y) sampleText.IndexOf(y, StringComparison.InvariantCulture) >= 0) Then
' code
End If
这篇关于如何使用 vb.net 查找字符串列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文