int n=0;
foreach (char c in s)
{
  if (c >= 0x4e00 && c <= 0x9fa5)
       n++;
}

解决方案 »

  1.   

    string s="字符串zifuchuan字符串zifuchuan";
    //byte[] b1 = System.Text.Encoding.ASCII.GetBytes(s);
    byte[] b2 = System.Text.Encoding.GetEncoding("GB2312").GetBytes(s);
    MessageBox.Show((b2.Length-s.Length).ToString());
      

  2.   

    int i= System.Text.Encoding.Default.GetBytes(strTmp).Length;
    int j= strTmp.Length;
    i-j 就是中文的个数
      

  3.   

    回复人: gujunyan(ivy) ( ) 信誉:99  2003-09-23 14:57:00  得分:0 
     
     
      int i= System.Text.Encoding.Default.GetBytes(strTmp).Length;?好像不行吧,測試過嗎?  
     
      

  4.   

    同意zhehui(小慧)  和 chinchy(人民需要人民币)
      

  5.   

    同意zhehui(小慧) 
    简单明了