'------------------------------------------------
' 字符串截除指定长度后的部分(考虑汉字字符串)
' 用途:显示文章标题列表
' 自定义函数:StringLen
'------------------------------------------------
function CutString( tempstr, pnDispLen )
dim cRet , nLoop
if pnDispLen <= 0 then
pnDispLen = 20
end if
if StringLen( tempstr ) > pnDispLen then
cRet = ""
nRetLen = 0
nLoop = 1
while nRetLen < pnDispLen
if asc( mid( tempstr, nLoop, 1 ) ) < 0 then ' 汉字
nRetLen = nRetLen + 2
else
nRetLen = nRetLen + 1
end if
cRet = cRet + mid(tempstr,nLoop,1)
nLoop = nLoop + 1
wend
CutString = cRet + "…"
else
CutString = tempstr
end if
end function
' 字符串截除指定长度后的部分(考虑汉字字符串)
' 用途:显示文章标题列表
' 自定义函数:StringLen
'------------------------------------------------
function CutString( tempstr, pnDispLen )
dim cRet , nLoop
if pnDispLen <= 0 then
pnDispLen = 20
end if
if StringLen( tempstr ) > pnDispLen then
cRet = ""
nRetLen = 0
nLoop = 1
while nRetLen < pnDispLen
if asc( mid( tempstr, nLoop, 1 ) ) < 0 then ' 汉字
nRetLen = nRetLen + 2
else
nRetLen = nRetLen + 1
end if
cRet = cRet + mid(tempstr,nLoop,1)
nLoop = nLoop + 1
wend
CutString = cRet + "…"
else
CutString = tempstr
end if
end function