有一段文本,“Because of you I never stray to far
from the sidewalk Because of you I learned to play
on the safe side ” 要求:
1.将文本中的所有you 换成 lanou, to 换成 too。
2.统计出此段文本中有多少个单词;
string arr = " Because of you I never stray to far from the sidewalk Because of you I learned to play on the safe side ";
string s = arr.Replace ("you", "lanou");
string s1 = s.Replace ("to", "too");
Console.WriteLine (s1);
string[] temp = s.Split (new char[]{ ' ' }, StringSplitOptions.RemoveEmptyEntries);
Console.WriteLine (temp.Length);