如何统计字段的汉字数?

bbzy 2005-05-30 05:17:12
我做了个新闻系统,其中采用ACCESS表,其中存放新闻内容的一个表的字段为备注型
我现在统计该字段的字节数,采用LEN统计,发现将其中的html语句也统计进来,
请问有什么办法准确统计文字数量.
...全文
110 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
bbzy 2005-05-31
  • 打赏
  • 举报
回复
News_Content=trim(rs("Content"))
content是个备注字段
不知为什么asc显示错误?
谢谢!
bbzy 2005-05-31
  • 打赏
  • 举报
回复
我是这样写的
dim charcount
charcount = 0
for i=1 to len(News_Content)+1 step 1
if asc(mid(News_Content,i,1))<0 or asc(mid(News_Content,i,1))>128 then
charcout = charcount+1
end if
next

News_Content是个备注型字段.


ljqhbt 2005-05-31
  • 打赏
  • 举报
回复
不会吧,连ASC函数都出错?
我也是用ASC啊。
bbzy 2005-05-31
  • 打赏
  • 举报
回复
to cslren(位流)
无效的过程调用或参数: 'asc'?
mkqiang 2005-05-31
  • 打赏
  • 举报
回复
记录
若白师妹 2005-05-31
  • 打赏
  • 举报
回复
去html
<%
xx="<html><head><title>asdasd</title></head><body>ddd111111</body></html>"
function RemoveHTML(fString)
dim re
set re = New RegExp
re.Global = True
re.IgnoreCase = True
're.MultiLine = True
if not isnull(fString) then
re.Pattern = "<a(.[^>]*)a>"
fString = re.Replace(fString,"")
RemoveHTML = fString
end if
end function

xx= RemoveHTML(content)
response.write (xx)
%>
bbzy 2005-05-31
  • 打赏
  • 举报
回复
help me
位流 2005-05-30
  • 打赏
  • 举报
回复
dim charcount
charcount = 0
for i=1 to len+1 step 1
if asc(mid(youstr,i,1))<0 or asc(mid(youstr,i,1))>128 then
charcout = charcount+1
end if
next

charcount 就是你要的

有空来我论坛逛逛http://www.eob.cn/bbs
bbzy 2005-05-30
  • 打赏
  • 举报
回复
可现在已经在表里了,有什么办法吗?
qunluo 2005-05-30
  • 打赏
  • 举报
回复
这种事情,不要把可以在客户端就可以处理掉的问题弄到数据库里再去处理,效率低不说,麻烦也更多!
bbzy 2005-05-30
  • 打赏
  • 举报
回复
不好去掉啊?
比如有些下面这种控制符<P class=MsoNormal style=""MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none""><SPAN
若白师妹 2005-05-30
  • 打赏
  • 举报
回复
把html先去掉再统计

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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