|
![]() |
名片设计 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系列讲座(十三)向浏览器传送脚本 下一教程: ASP写的日志处理方式 您可以阅读与"测字符串长度函数"相关的教程: · 生成指定长度的随机字符串 · ASP中字符串函数的应用 · 控制输出字符串的长度,可以区别中英文 · 一套相称实用的加解密字符串的函数 · 截取固定长度字符串显示在页面,多余部分显示为省略号(区分汉字和字符) |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |