最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
检测含有中文字符串的实际长度
时间:2022-06-30 09:33:32 编辑:袖梨 来源:一聚教程网
"*************测字符串长度**************
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
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
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
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
相关文章
- 王者荣耀明世隐夜落电台怎么获得 明世隐夜落电台上架介绍 05-09
- 原神虹色巡回第二阶段怎么攻略 原神虹色巡回第二阶段完成方法 05-09
- 恋与深空银月流烁夜活动怎么玩 恋与深空银月流烁夜活动玩法介绍 05-09
- 王者荣耀西游英雄怎么领 王者荣耀送西游主题资源活动介绍 05-09
- 币宝交易所3.0官网版 05-09
- coinbene满币交易所官网版 05-09