1、純粹的截取字符串
復制代碼 代碼如下:
function cutstr(thestr1,strlen)
dim l,t,c
l=len(thestr1)
if l1 then exit function
t=0
for dxy1=1 to l
c=Abs(asc(Mid(thestr1,dxy1,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
thev=mid(thestr1,1,dxy1)
exit for
else
thev=thestr1
end if
next
cutstr=thev
end function
2、截取字符串,不足用空格補上
復制代碼 代碼如下:
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
您可能感興趣的文章:- asp下實現截取字符串特定部分內容函數
- asp 字符串截取函數
- GetBody asp實現截取字符串的代碼
- 用asp實現的截取指定格式字符串的代碼
- asp從字符串里截取N個帶HTML的字符的函數
- asp截取指定英漢混合字符串_支持中文
- ASP.NET 字符串截取
- asp CutStrX字符串截取函數(過濾全部HTML標記)
- asp實現截取字符串函數