首页 | DV动态 | 数码产品 | 视频采编 | 网站建设 |
【收藏DV】
  最近3月排行
没有文章。
截取制定长度字符串
2004/11/20 17:47:46
 

'"*************测字符串长度**************
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 cutstr(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
cutstr = txt
else
cutstr = ""
end if
End Function
(DVOL本文转自:中国DV传媒 http://www.dvol.cn)

欢迎关注微信公众账号:手机烟台(mYantai)

 

  上一篇:使用break-all控制表格按指定宽度换行
  下一篇:页面中点击鼠标右键--弹出与windows界面相似的菜单
      更多...
::打印本页 ::      ::关闭窗口::


版权所有© 数码在线网站 DV OnLine©  鲁ICP备12016322号-1