namespace FindWord
{
class Program
{
static void Main(string[] args)
{
string sentence = "我希望有个如你一般的人 如山间清爽的风 如古城温暖的光 从清晨到夜晚 由山野到书房 只要最后是你就好";
Console.Write("请输入要检索的词语:");
string word = Console.ReadLine();
if (sentence.IndexOf(word)>=0)//从第几个字开始查找
{
Console.WriteLine("词语“{0}”在句子“{1}”中!",word,sentence);
}
else
{
Console.WriteLine("在句子中没有找到词语“{0}”,请重新输入检索词!", word);
}
}
}
}