字符串截取指定长度的函数
dfwxj 2014-08-14 12:58:02 一个简单的函数,返回一个字符串按指定长度依次截取第N段的内容,不受双字节影响。参照十豆三提供的代码实现。
Function cutstr
Parameters cstr,nLen,N
Private newstr,i
For i=1 To N
newstr=Iif(Between(Asc(Rightc(Left(cstr,nlen),1)),128,255),Left(cstr,nlen-1),Left(cstr,nlen))
cstr=Iif(Between(Asc(Rightc(Left(cstr,nlen),1)),128,255),Substr(cstr,nlen),Substr(cstr,nlen+1))
Endf
Return newstr