假如字符串 S7+S7-S7*
那我要怎么判断 S7+  在上面的字符串里面
有自己的函数吗?

解决方案 »

  1.   

    string str="S7+S7-S7";
    if(str.contains("S7+"))
    {
      Response.write("包含S7+");
    }
      

  2.   

    不知道有没有//a = "S7+S7-S7*";
    //b =”S7+“
    protected bool IsContains(string a,string b){
    if (a.Replace(b)==a)
     return true;
    else
     return false;
    }
      

  3.   

    反了//a = "S7+S7-S7*";
    //b =”S7+“
    protected bool IsContains(string a,string b){
    if (a.Replace(b)==a)
     return false; 
    else 
     return true; 
    }
      

  4.   


      string   a;   
      string   b;   
      if(a.IndexOf(b)!=-1)   
      {   
         Response.write("包含S7+"); 
      }   
      

  5.   

    string aa = "S7+S7-S7*";
            
    if(aa.IndexOf("s7+")!=-1)
       Response.writh("包含")