Linq 语句模糊查询排除大小写

 1. const string text = @"Historically, the world of data and the world of objects" +
 2                                 @" have not been well integrated. Programmers work in C# or Visual Basic" +
 3                                 @" and also in SQL or XQuery. On the one side are concepts such as classes," +
 4                                 @" objects, fields, inheritance, and .NET Framework APIs. On the other side" +
 5                                 @" are tables, columns, rows, nodes, and separate languages for dealing with" +
 6                                 @" them. Data types often require translation between the two worlds; there are" +
 7                                 @" different standard functions. Because the object world has no notion of query, a" +
 8                                 @" query can only be represented as a string without compile-time type checking or" +
 9                                 @" IntelliSense support in the IDE. Transferring data from SQL tables or XML trees to" +
10                                 @" objects in memory is often tedious and error-prone.";
11 
12             const string searchTerm = "data";
13 
15             var source = text.Split(new[] { '.', '?', '!', ' ', ';', ':', ',' }, StringSplitOptions.RemoveEmptyEntries);
16 
17             //创建查询,并忽略大小写比较
18             var matchQuery = from word in source
19                              where string.Equals(word, searchTerm, StringComparison.InvariantCultureIgnoreCase)
20                              select word;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值