首页 新闻 赞助 找找看

求 一 linq查询语句

0
悬赏园豆:10 [已解决问题] 解决于 2010-10-31 07:47

查询首字母为 数字 的记录

误人子弟的主页 误人子弟 | 初学一级 | 园豆:0
提问于:2010-10-13 23:16
< >
分享
最佳答案
0

            List<string> strlist = new List<string>();

            strlist.Add("1asdf");
            strlist.Add("2asdf");
            strlist.Add("easdf");
            strlist.Add("tasdf");

            var list = from l in strlist
                       where ASCIIEncoding.ASCII.GetBytes(l.ToString().Substring(0,1))[0] >= 48 && ASCIIEncoding.ASCII.GetBytes(l.ToString().Substring(0,1))[0] <= 57
                       select l;

            foreach(string str in list)
            {
                Console.WriteLine(str);
            }

收获园豆:10
一滴血 | 小虾三级 |园豆:1602 | 2010-10-14 00:11
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册