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="nbsp;"
strbuall=strbuallstrbu
next
thev=thestrstrbuall
strbu=""
strbuall=""
end if
next
cutstr=thev
end function
%
'============================
'函數(shù)名w_cut(type,num)
'作用:字符串截取
'參數(shù)type,num
'type:字符串內(nèi)容
'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 cnum0 then w_cut=w_cut"...":exit for
tt=mid(ctypes,ci,1)
if int(asc(tt))>=0 then
w_cut=w_cuttt
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_cuttt
end if
next
End Function
%>
標(biāo)簽:天津 懷化 麗江 內(nèi)江 重慶 臺(tái)灣 成都 公主嶺
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《截取實(shí)際長度字符串,并用空格替換》,本文關(guān)鍵詞 截取,實(shí)際,長度,字符串,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。