用C#怎么编写---一篇英文文章中的所有的英文单词都调取出来

我的意思是 有随便的一篇英文文章,我想把文章里的所有的英文单词都调取出来,比如 I am a chinese.So i love China.......等等。。。 输出的结果就是
I
am
a
chinese
.
so
i
love
China
.
.......
谢谢大家帮忙,有消息的话 请发到我的MSN:[email protected]
MatchCollection matches = Regex.Matches(strSource, @"(([\w]+)|([\.]{1})(?=[^\.]{1})|([\.]{1})(?=[\.]{6})|([\.]{6,6}))");这个代码是啥意思啊?大侠帮解释下

static void Main(string[] args)
8 {
9 string strSource = " I am a chinese.So i love China.";
10
11 MatchCollection matches = Regex.Matches(strSource, @"(([\w]+)|([\.]{1})(?=[^\.]{1})|([\.]{1})(?=[\.]{6})|([\.]{6,6}))");
12
13 for (int i=0;i<matches.Count;i++)
14 {
15 Console.WriteLine(matches[i].Groups[1].Value);
16 }
17
18 Console.ReadKey();
19 }
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-06-17
第一..问题是你会c#么?会的话不用说那么多...
第二..思路是用string的split函数...这个函数的用处是 返回被你输入的参数 分割的字符串,那么就例如:
string words = "this is a list of words, with: a bit of punctuation.";

string [] split = words.Split(new Char [] {' ', ',', '.', ':'});

foreach (string s in split) {

if (s.Trim() != "")
Console.WriteLine(s);
第2个回答  2009-06-17
string strIn ="I am a Teacher,I love China.";
string[] sArray = strIn.Split(' ',',','.','?');
foreach (string i in sArray)
{
Console.WriteLine(i.ToString());
Console.WriteLine("\n");
}
Console.ReadLine();
第3个回答  2009-06-18
用正则表达式
\w*(?x)
这个个人认为比较科学,效率应该会好些
第4个回答  2009-06-17
明天发到你的邮箱,
相似回答