|
![]() |
名片设计 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语句的安全性问题 您可以阅读与"检测含有中文字符串的实际长度"相关的教程: · 控制输出字符串的长度,可以区别中英文 · 用两种不同的方式来求实现数字字符串的最大,最小和平均值 · 获得ASP的中文日期字符串 · 再来一套加解密字符串的FUNCTION · 测字符串长度函数 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |