string str="this is china and very good country i have ever seen in earth. but there is such people who did not 
aware their brothers and sisters like animal, except for a few chinese people."
我有这个字符串 string temp="brothers and sisters" 我要用这个字符串来获取它的完整句子.比如: but there is such people who did not aware their brothers and sisters like animal, except for a few chinese people.
怎么能取temp两边的规定的字符串...

解决方案 »

  1.   

    <字符串>.Split(new  char[]  {  分割字符列表  });你可以先把句子用“。”分成单个的句子,再用IndexOf()查找brothers and sisters在哪个句子,就可以输出哪个句子就行了
      

  2.   

    正则:
    string s = @"this is china and very good country i have ever seen in earth. but there is such people who did not aware their brothers and sisters like animal, except for a few chinese people.";
    MatchCollection matches = Regex.Matches("." + s, @"(?is)(?<=\.)[^.]*brothers and sisters[^.]*\.");
    foreach (Match match in matches)
    Console.WriteLine(match.Value);
      

  3.   

      对,正则和string的split方法均可以。