如果要判断一个字符串里的全角字符数 ,只需用字符串的字节数减去字符串的字数即可:
int wordsCount,bytesCount;
string str = this.textBox1.Text;
wordsCount = str.Length;
bytesCount = Encoding.Default.GetByteCount(str);
this.textBox2.Text = bytesCount.ToString();
this.textBox3.Text = wordsCount.ToString();
1559

被折叠的 条评论
为什么被折叠?



