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
TongJi()将上面代码保存为TongJi.vbs,在TongJi.vbs同目录下建立ok.txt文本文件,将你要统计的文本复制到ok.txt中,运行TongJi.vbs即可以统计字数,与word的功能一样。不过算法不一样,结果也不太一样,原因是如何理解何为“有效字符”
重新安装ie的一个vbs
'run_ie_reinstall.vbs-RunstheInternetExplorerSetup'?DougKnox-4/10/2002'Downloadedfromwww.dougknox.comX=MsgBox("DoyouwanttoreinstallInternetExplorer?",vbYesNo,"Prompt!")Y=MsgBox("DoyouwanttoreinstallOu
中文姓名笔画计算(VBS脚本版)
'中文姓名笔画计算(VBS脚本版)dimword,keyword=inputbox("请输入你要计算的文字")ifword=""thenmsgbox"小样不是叫你不要输入文字吗"Wscript.Quitendifkey=char_wordnum(word)
VBS 数字转英文代码
如何创建名为SpellNumber的示例函数启动MicrosoftExcel。按Alt+F11启动VisualBasic编辑器。在插入菜单上,单击模块。在模块表中键入下面的代码。OptionExplicit'Main
编辑:广州明生医药有限公司
标签:字符,你要,笔画,代码,中文