测字符串长度函数_asp
'*************测字符串长度**************
Function CheckStringLength(txt)
txt=trim(txt)
x = len(txt)
y = 0
for ii = 1 to x
if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是汉字
y = y + 2
else
http://www.gaodaima.com/66128.html测字符串长度函数_asp
y = y + 1
end if
next
CheckStringLength = y
End Function
'************* 截取字符串 **************
function InterceptString(txt,length)
txt=trim(txt)
x = len(txt)
y = 0
if x >= 1 then
for ii = 1 to x
if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是汉字
y = y + 2
else
y = y + 1
end if
if y >= length then
txt = left(trim(txt),ii) '字符串限长
exit for
end if
next
InterceptString = txt
else
InterceptString = ""
end if
End Function
欢迎大家阅读《测字符串长度函数_asp》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码
原创文章,转载请注明: 转载自搞代码
本文链接地址: 测字符串长度函数_asp

微信 赏一包辣条吧~

支付宝 赏一听可乐吧~
发表评论