int i = this.textBox1.Text.Length - (this.textBox1.Lines.Length - 1) * 2;
对,这要根据你不同的要求,举例如下://取字符串长度 s = "a12字符串"; int len = s.Length;//will output as 6 byte[] sarr = System.Text.Encoding.Default.GetBytes(s); len = sarr.Length;//will output as 3+3*2=9
int i = this.textBox1.Text.Length - (this.textBox1.Lines.Length - 1) * 2;
s = "a12字符串";
int len = s.Length;//will output as 6
byte[] sarr = System.Text.Encoding.Default.GetBytes(s);
len = sarr.Length;//will output as 3+3*2=9
理由:在C#中使用char数据类型来代表Unicode字符.
由于本人还是初学者。您可以给一段完整的代码给我吗?还有另外一个问题如何判断文本框里输入的是否时间(12:01)大概就是这种格式。希望可以把这两的问题的代码贴出。谢谢!