|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
"*************测字符串长度************** 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 返回类别: 教程 上一教程: 正则表达式在网页处理中的应用四则 下一教程: 在ASP程序中执行SQL语句的安全性问题 您可以阅读与"检测含有中文字符串的实际长度"相关的教程: · 控制输出字符串的长度,可以区别中英文 · 截取固定长度字符串显示在页面 · 再来一套加解密字符串的FUNCTION · 一套加解密字符串的函数 · 使用SPLIT分割多字符的字符串的方式 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |