String myString = "aaabcaa";
// This is true.
bool test1 = String.Compare(myString.Substring(3, 3), "abc") == 0; 

解决方案 »

  1.   

    string str = "hello";string find = "he";if( str.IndexOf(find)!=-1 )
       //存在
    else
       //不存在
      

  2.   

    报告指定的 String 在此实例内的最后一个匹配项的索引位置。
    public int LastIndexOf(string);报告指定的 String 在此实例内的最后一个匹配项的索引位置。该搜索从指定字符位置开始。
    public int LastIndexOf(string, int);报告指定的 String 在此实例内的最后一个匹配项的索引位置。搜索从指定字符位置开始,并检查指定数量的字符位置。
    public int LastIndexOf(string, int, int);
      

  3.   

    在.net的帮助中输入以下地址:
    ms-help://MS.NETFrameworkSDK.CHS/cpguidenf/html/cpconcomparingstrings.htm
      

  4.   

    string str = "hello";string find = "he";if( str.IndexOf(find)!=-1 )
       //存在
    else
       //不存在