| 首页 | 电脑常识 | 程序设计 | 操作系统 | 语法 | 病毒安全 | 软件教程 | 硬件 | 数据库 | 多媒体 | 认证 | 下载 | 
首页>>网络 >>ASP编程
测字符串长度函数

测字符串长度函数

电脑学习网,xuef.com,最全最新最权威的电脑知识网站.
免费计算机学习教程,电脑入门指南.
'*************测字符串长度**************

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

相 关 文 章
  • DynamicDateDrop-downBoxes

  • 在客户端执行数据库记录的分页显示----3

  • 在客户端执行数据库记录的分页显示----2

  • 在客户端执行数据库记录的分页显示----1

  • ReDim语句

  • 一个天气预报的小偷

  • ASP中使用Session变量的优缺点

  • GB码和BIG5码的互换技术

  • ASP直接调用EXCEL数据的例子(不用ODBC)

  • 人民币小写转换为大写

  • 电脑学习天堂
    中国电脑教学网,电脑爱好者的乐园,做最好最全的计算机学习网站.