知识库

显示左边的n个字符(以及汉字)函数

来源: 本站    类别: 知识库    日期: 2015/1/1

 rem 显示左边的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

相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com