首页 | 免费域名 | 个人服务器 | 一流信息监控拦截系统 | 虚拟主机知识库 | ASP 空间 | ASP技术大全 | 下载中心 | 客户服务中心
  7i24 > ASP技术大全 > 代码乐园 >
    7i24 .Com  
  获得字符串的真正长度

7i24.Com不停为您服务


在中文系统下,vb和vbscript程序,len("中文abc")=5而不是7
而lenb("中文abc")=10,要获得正确获得正确的字节数,必须自
己写一个函数,as follows:
    function strLength(str)
    dim WINNT_CHINESE
    WINNT_CHINESE=(len("飞鸟")=2)
    if WINNT_CHINESE then
      dim l,t,c
     dim i
     l=len(str)
     t=l
     for i=1 to l
      c=asc(mid(str,i,1))
      if c<0 then c=c+65536
      if c>255 then
       t=t+1
      end if
     next
     strLength=t
    else
     strLength=len(str)
    end if
    end function


  2002年1月14日  阅读 960 次  发送此页给朋友  来源:    版权争议  删除

相关文章:   近期热点:

上一篇: 解决“Server is too busy”问题
下一篇: asp 访问foxpro3.0的例子
返回上一层...
搜索:

(C)2004-2022 7i24.Com 保留所有权利