自己用的一个求字符串长度的东东,大家可以编译了以后直接引用。
点击次数:26 次 发布日期:2008-11-27 01:22:08 作者:源代码网
|
using System.Text; namespace PubClass.CSharp.String { public class UTP8String { public long Length(string strLen) { bool winnt_chinese=true; winnt_chinese=("中国".Length ==2); if(winnt_chinese) { long l,t,c; int i; l=strLen.Length ; t=l; for( i=0;i<l;i++) { c=(int)strLen[i]; if( c<0) { c=c+65536; } if (c>255) { t=t+1; } } return t; } else { return strLen.Length ; } } } } & 源代码网供稿. |
