idcbe.com
Tag: 字节数预览模式: 普通 | 列表

根据字符串内容,可分为以下两种情况:

1.英文下,len(rs("field")),就行了.例如:len("中文abc")=7 
2.中文下,会复杂一点,例如:len("中文abc")=5 而不是7,而lenB("中文abc")=10。所以需要自己写程序判断其长度. 

函数如下:
function strLen(str) 
dim i,l,t,c 
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 
strLen=t 
end function

引用:strLen(rs("field"))

查看更多...

Tags: ASP 备注字段 长度 大小 字节数 字符串

分类:网站建设 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 7488