Function cutStr(str,strlen)
dim l,t,c
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
cutStr=left(str,i)
exit for
else
cutStr=str
end if
next
cutStr=replace(cutStr,chr(10),"")
end Function
asp忽略中英文截取字符串
最新推荐文章于 2020-03-31 11:51:01 发布
本文介绍了一个用于截取字符串的VBScript函数FunctioncutStr。该函数能够根据指定长度截取包含中英文字符的字符串,并考虑了全角和半角字符的不同长度。
7万+

被折叠的 条评论
为什么被折叠?



