function titleb(str,strlen) 'left替换函数(按字节截取) '============================================= '参数说明 'str 被截取的字符串 'strlen 需要截取的长度[字节数] '============================================= Dim Bstrlen 'strlen 为字节数 bstrlen=strlen If isempty(str) or isnull(str) or str="" Then titleb=str exit function Else dim l,t,c,i 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>=bstrlen then titleb=left(str,i) exit for else titleb=str&"" end if next End If end function 飞飞Asp技!术乐园
|