Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > asp技巧

截取实际长度字符串,并用空格替换

来源:中文源码网    浏览:150 次    日期:2024-04-30 01:38:05
【下载文档:  截取实际长度字符串,并用空格替换.txt 】


截取实际长度字符串,并用空格替换
function cutstr(thestr,strlen)dim l,t,cl=len(thestr)t=0for dxy=1 to lc=Abs(asc(Mid(thestr,dxy,1)))if c>255 thent=t+2elset=t+1end ifif t>=strlen thenthev=left(thestr,dxy)exit forelsebu=strlen-tfor bui=1 to bustrbu=" "strbuall=strbuall&strbunextthev=thestr&strbuallstrbu=""strbuall=""end ifnextcutstr=thevend function
<%'============================'函数名w_cut(type,num)'作用:字符串截取'参数type,num'type:字符串内容'num:字符串被截取的长度'=============================
Function w_cut(types,num) dim ctypes,cnum,ci,tt,tc,cc ctypes=types:cnum=int(num):w_cut="":tc=0:cc=0 for ci=1 to len(ctypes) if cnum<0 then w_cut=w_cut&"...":exit for tt=mid(ctypes,ci,1) if int(asc(tt))>=0 then w_cut=w_cut&tt tc=tc+1:cc=cc+1 if tc=2 then tc=0:cnum=cnum-1 end if if cc>5 then cnum=cnum-1:cc=0 else cnum=cnum-1 if cnum<=0 then w_cut=w_cut&"...":exit for w_cut=w_cut&tt end if nextEnd Function
%>

相关内容