统计字符串的长度

 1     public int WordStatistical(string CString)
 2     {
 3         int digit = 0 ;
 4         for (int i = 0 ;i < CString.Length ; i++)
 5         {
 6             if (Convert.ToInt32(Convert.ToChar(CString.Substring(i,1)))<Convert.ToInt32(Convert.ToChar(128)))
 7             {
 8                 digit += 1;
 9             }
10             else
11             {
12                 digit += 2;
13             }
14         }
15         return digit;
16     }

posted on 2006-12-06 17:53  Gavin Hu  阅读(295)  评论(1编辑  收藏  举报

导航