如何得到string的字节数 http://dotnet.aspx.cc/ShowDetail.aspx?id=48596EF2-8C16-47EE-1CD3-174E44FA9E24 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string youstr="看看看看look"char []cc=youstr.ToCharArray()int intlen=youstr.Length;int i;for(i=0;i<cc.length;i++){if(cc[!].ToString()>255){intlen++;}}Resposne.Write(intlen); string youstr="看看看看look"char []cc=youstr.ToCharArray()int intlen=youstr.Length;int i;for(i=0;i<cc.length;i++){if(cc[i].ToString()>255){intlen++;}}Resposne.Write(intlen); 不用看,也不用算,.NET中一个字总是2BYTE int i = System.Text.ASCIIEncoding.Default.GetByteCount(str.ToCharArray()) 你这说的是算ANSI的字节数吧。byte [] byteOut = System.Text.Encoding.GetEncoding(0).GetBytes(s2);byteOut.Length 就是你想要的了。 ComboBox设定SelectedValue值,Text值显示问题!!! 求组代码 我这做了一个验证码,为什么图片显示不出来 呢? [求助]我写的程序有点问题,请大家指教一下,感激不尽啊! .net版本问题 可空类型与数据库记录添加的问题。。。 处理BLOB字段 C# 如何判断鼠标单击还是双击? 抱歉,初学让大家见笑了。请问如何获得一个类或结构的大小? 淘宝登录ua算法 如何通过XSLT转换RTF格式文件 让RadioButton在DataGrid里实现单选功能,不是多选,列出源代码,在线等,顶者也加分
char []cc=youstr.ToCharArray()
int intlen=youstr.Length;
int i;
for(i=0;i<cc.length;i++)
{
if(cc[!].ToString()>255){
intlen++;
}
}Resposne.Write(intlen);
char []cc=youstr.ToCharArray()
int intlen=youstr.Length;
int i;
for(i=0;i<cc.length;i++)
{
if(cc[i].ToString()>255){
intlen++;
}
}Resposne.Write(intlen);
byte [] byteOut = System.Text.Encoding.GetEncoding(0).GetBytes(s2);
byteOut.Length 就是你想要的了。