用于查找字符串的Linq命令 [英] Linq Command for Find a String

查看:60
本文介绍了用于查找字符串的Linq命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

i有一个文本和这样的数组:

 私人 ArraySides()作为 字符串 = {  Out Side  Up Down  Top Buttom} 

Dim StrSide as String = 这是Out Side





现在如果有StrSide,我如何从ArraySides中找到我的单词

谢谢

解决方案

使用下面的代码



  var  exists = ArraySides.Any(StrSide); 





变量存在将包含bool ean值是否你的字符串是否存在于数组中。


谢谢你,这是vb.net代码那样:

  If  ArraySides.Any( Function (s)StrSide.Contains(s))然后 
结束 如果


hi everyone
i have a text and an array like this :

Private ArraySides() As String = {"Out Side", "Up Down", "Top Buttom"}

Dim StrSide as String="This is Out Side"



Now how can i find my word from ArraySides if there is in StrSide
Thanks

解决方案

Use below code

var exists= ArraySides.Any(StrSide);



variable exists will contain boolean value whether your string exists in array or not.


thank you and this is vb.net Code Like that :

  If ArraySides.Any(Function(s) StrSide.Contains(s)) Then
end if


这篇关于用于查找字符串的Linq命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆