- ·上一篇文章:常见对象 - WScript.Network
- ·下一篇文章:Imail密码加密算法及VBS实现
- ·百度中搜索更多的关于“vbs实现统计字符模块”相关内容
- ·谷歌中搜索更多的关于“vbs实现统计字符模块”相关内容
- ******申明******
- 本站文章内容有部分为收录网络中其他网友内容,DOS资源站不保证所有的代码都适合你使用。
- 由于编辑匆忙,有可能造成某些脚本文件出现丢失代码或代码无法运行的情况,请网友根据情况自行修改。
- 如果能将出错部分反馈给我,那就更好了。
vbs实现统计字符模块
Sub TongJi()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("ok.txt", 1)
strText = objFile.ReadAll
All = Len(strText)
S="` ~ ! @ # $ % ^ & * ( ) - _ = + \ | [ { ] } ; : ' , < . > / ? · ! ¥ ( ) 、 【 】 ; : ‘ ’ “ ” , 《 。 》 ? …… —— chr(34) vbCrLf"
Signs=Split(S," ")
For Each Sign in Signs
strText = Replace(strText, "Sign", " ")
Next
objFile.Close
For k=1 To Len(strText)
tmpStr=Mid(strText, k, 1)
If Asc(tmpStr) > 127 Or Asc(tmpStr) < 0 Then
c = c + 1
tmpStr=" "
End If
Str = Str + tmpStr
Next
arrWords = Split(Str, " ")
For Each strWord in arrWords
If Len(strWord) > 0 Then
i = i + 1
End If
Next
Sum = c + i
msgbox "字符总数:" & All & chr(13) & "有效字符:" & Sum & chr(13) & "汉字总数:" & c, 64, "字符统计"
End sub

