手机
当前位置:查字典教程网 >编程开发 >ASP教程 >截取实际长度字符串,并用空格替换
截取实际长度字符串,并用空格替换
摘要:functioncutstr(thestr,strlen)diml,t,cl=len(thestr)t=0fordxy=1tolc=Abs(...

function cutstr(thestr,strlen)

dim l,t,c

l=len(thestr)

t=0

for dxy=1 to l

c=Abs(asc(Mid(thestr,dxy,1)))

if c>255 then

t=t+2

else

t=t+1

end if

if t>=strlen then

thev=left(thestr,dxy)

exit for

else

bu=strlen-t

for bui=1 to bu

strbu=""

strbuall=strbuall&strbu

next

thev=thestr&strbuall

strbu=""

strbuall=""

end if

next

cutstr=thev

end 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

next

End Function

%>

【截取实际长度字符串,并用空格替换】相关文章:

如何截取asp后台登陆密码的代码

获取字符中中文首字字符

通过MSXML2自动获取QQ个人头像及在线情况(给初学者)

ASP处理查询超时的解决函数

asp实现无限级分类的方法js版

判断字符串中相同字符的个数

asp 字符串连接数据库方法

msxml3.dll 错误 '800c0005'解决方案

ASP中一个字符串处理类

由给定的字符串生成关键字

精品推荐
分类导航