本帖最后由 邢凯 于 2014-7-31 18:10 编辑
- string str = "How are you ? Fine,Thank you !";
- char[] achar = { ' ', '?', '!', ',' };
- string[] words = str.Split(achar, StringSplitOptions.RemoveEmptyEntries);
- Console.WriteLine("上面一共有{0}个单词",words.Length);
- Console.WriteLine("每个单词分别为");
- for (int i = 0; i < str.Length; i++)
- {
- Console.Write(str[i]);
- }
- Console.ReadLine();
复制代码
输出的结果为下面的图,求大伙帮帮忙 看看是咋啦 |
|