您的位置首页百科知识

用VBScript编个函数

用VBScript编个函数

的有关信息介绍如下:

用VBScript编个函数

用这段把,动易公司开发的系统都是用搞的这个,只不是函数名称不同,但是觉得功能一样!'**************************************************'函数名:gotTopic'作 用:截字符串,汉字一个算两个字符,英文算一个字符'参 数:str ----原字符串' strlen ----截取长度'返回值:截取后的字符串'**************************************************function gotTopic(str,strlen) if str="" then gotTopic="" exit function end if dim l,t,c, i str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","<") 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," "," "),chr(34),"""),">",">"),"<","<")end function