UTF-8编码下的字符截断

ningqf 2006-03-26 09:22:24
以前在GB2312编码下正常的字符截断函数在UTF-8下无效了
哪位高手有解决方案啊,ASP vbs
function MyCutstr(tempstr,tempwid)
if len(tempstr)>tempwid then
mycutstr=left(tempstr,tempwid)&"..."
else
mycutstr=tempstr
end if
end function

比如上面这个函数,直接给tempwid数字,有效
但是通过参数传递就没有用了
...全文
94 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
cuteleaf 2006-03-27
  • 打赏
  • 举报
回复
先在函数中做cint(tempwid)处理

也就是说mycutstr=left(tempstr,cint(tempwid))&"..."
试试
ningqf 2006-03-27
  • 打赏
  • 举报
回复
果然可以了

7,765

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧