法语2课后答案:如何用VB只提取网页中汉字

来源:百度文库 编辑:高考问答 时间:2024/05/06 00:41:04
如何只提取汉字,不要把<width=20,height=30,color=# 之类的东西留下来了,把它们都不要了,只要汉字。VB中该如何解决呢。

思路:

'strget为网页文字
'strsave为保存中文
dim ascword as long
dim strmid as string
do while posnow<len(strget)
ascword=mid(strget,posnow,1)
strmid=chr(ascword)
if ascword >N1 and ascword<N2 then 'N1,N2是chr(汉字)的UNICODE,书上有介绍我忘记是多少了
strsave=strsave & ascword
end if
posnow=posnow+1
loop

'代码未经验证,仅为参考