8,497
社区成员
发帖
与我相关
我的任务
分享
static void Main(string[] args)
{
string[] strings=
{
"A penny saved is a penny earned.",
"The aaxly sdj",
"the pa is no"
};
var query =
from sentence in strings
let words = sentence.Split(' ')//用空格分割成数组
from word in words
let w = word.ToLower()//把每个字母小写
where w[0] == 'a' || w[0] == 'e'
select word;
foreach (var s in query)
{
Console.WriteLine(s);
}
Console.ReadLine();
}
var query2 =
strings.Select(a => a.Split(' '))
.SelectMany(b => b.Where(c => c.ToLower()[0] == 'a' || c.ToLower()[0] == 'e'));
分不给一楼,谁来接分!!!