---------------------- ASP.Net+Unity开发、.Net培训、期待与您交流! ----------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 字符串
{
class Program
{
static void Main(string[] args)
{
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.WriteLine(words[i]);
}
Console.ReadLine();
}
}
}