比如:111;233;456;7799;
一看就知道有四个封号,我想得到的数据就是4,请问代码该如何写?

解决方案 »

  1.   


                               string strTest = "111;233;456;7799;";                           int intLength; intLength = strTest.Length - strTest.Replace(";", "").Length);
      

  2.   

    string strTest = "111;233;456;7799;"; int intLength; intLength = strTest.Length - strTest.Replace(";", "").Length;
      

  3.   

    string str="111;233;456;7799;";
    string[] split=str.Split(new char[]{\';\'});
    Response.write(split.Length);
    这样可不可以?