发新话题
打印

显示左边的n个字符函数(自动识别汉字)

显示左边的n个字符函数(自动识别汉字)

Function LeftTrue(str,n)
If len(str)<=n/2 Then
LeftTrue=str
Else
l=len(str)
t=l
TStr=""
t=0
for i=1 to l
c=asc(mid(str,i,1))
If c<0 then c=c 65536
If c>255 then
t=t 2
Else
t=t 1
End If
If t>n Then exit for
TStr=TStr&(mid(str,i,1))
next
LeftTrue = TStr
End If
End Function

[ 本帖最后由 shy_37 于 2007-10-11 17:13 编辑 ]

TOP

发新话题