指引网

当前位置: 主页 > 编程开发 > ASP >

asp取得字符长度函数

来源:网络 作者:佚名 点击: 时间:2017-08-23 21:44
[摘要] 指引教程为您提供asp取得字符长度函数等资源,欢迎您收藏本站,我们将为您提供最新的asp取得字符长度函数资源
<script>ec(2);</script>

function gotTopic(str,strlen)
 if str="" then
  gotTopic=""
  exit function
 end if
 dim l,t,c, i
 str=replace(replace(replace(replace(str,"&nbsp;"," "),"&quot;",chr(34)),"&gt;",">"),"&lt;","<")
 l=len(str)
 t=0
 for i=1 to l
  c=Abs(Asc(Mid(str,i,1)))
  if c>255 then
   t=t 2
  else
   t=t 1
  end if
  if t>=strlen then
   gotTopic=left(str,i) & "…"
   exit for
  else
   gotTopic=str
  end if
 next
 gotTopic=replace(replace(replace(replace(gotTopic," ","&nbsp;"),chr(34),"&quot;"),">","&gt;"),"<","&lt;")
end function

------分隔线----------------------------