function getStrLength(strTemp)'用於求中英文字符串的长度
strTemp=replace(strTemp,""","""")
dim DBCS
DBCS = (len("中文")=2) '双字节字符集(DBCS)
if DBCS then
strlen=len(strTemp)
trueLen=strlen
dim i
for i=1 to strlen
c=asc(mid(strTemp,i,1))
if c<0 or c>255 then
trueLen=trueLen+1
end if
next
getStrLength=Cint(trueLen/2)
else
getStrLength=len(strTemp)
end if
end function
function convert_to_fit_lenght(titleTemp,lenTemp)
dim l
l=1.0
dim ch
returnlength=1
do while Abs(Int(-l))<lenTemp and returnlength<=len(titleTemp)
ch=mid(titleTemp,returnlength,1)
if asc(ch) < 0 or asc(ch) > 255 then
l=l+1
else
l=l+0.5
end if
returnlength=returnlength+1
loop
convert_to_fit_lenght = returnlength
end function
function myLeft(titleTemp,lenTemp)
myLeft = Left(titleTemp,convert_to_fit_lenght(titleTemp,lenTemp))
end function
不知道你看不看得懂。。。