2. Write a piece of code, it should be able to split a English sentence to
a list of strings. Then test your code with a test code.
(编写一段程序,使得你的程序可以将一段英语按空格拆分成一组字符串。编写一度
代码来测试你的程序。)
例:假设你的方法如下:
public static string[] DivideSentence(string msg);
当以如下方式调用该方法时
string msg = "The fox jump over the log.";
string[] segs = DivideSentence(msg);
foreach(string s in segs)
{
Console.WriteLine(s);
}
控制台输出结果为:
The
fox
jump
over
the
log.
我想问
DivideSentence 怎么写