现在Session["code1"].ToString() 为 9.13.0790000001RS(3G信息IT790B成品机)
有什么办法使  (3G信息IT790B成品机) 这几个字去掉
this.TextBox4.Text = Session["code1"].ToString();
效果如下
 this.TextBox4.Text 的格子上体现 9.13.0790000001RS
也就是说this.TextBox4.Text="9.13.0790000001RS";在此先谢过

解决方案 »

  1.   

    这个容易啊,储存的时候,不要存进去就行了。
    要不这样也行
    Session["code1"].ToString().substring(0,16);
      

  2.   


    void Main()
    {
        
    Regex r=new  Regex(@"(?=\().*(?<=\))");
    string s=r.Replace("9.13.0790000001RS(3G信息IT790B成品机)","");
    Console.WriteLine(s);
    }// 结果:
    //9.13.0790000001RS
      

  3.   

    this.TextBox4.Text = Session["code1"].ToString().Remove(Session["code1"].ToString().IndexOf("("));
      

  4.   

    string str=Session["code1"].ToString();
    str=str.substring(0,str.indexof("("));
    textbox4.text=str;
      

  5.   

    string str=Session["code1"].ToString;
    if(str.Length>16)
    {
        str=Session["code1"].ToString().substring(0,16);
    }
      

  6.   

    Session["code1"].ToString().Substring(0,Session["code1"].ToString().Indexof("(");