In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "vbs how to achieve character statistics function", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "vbs how to achieve character statistics function" this article.
Character statistics function module
The code is as follows:
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 Kitch1 To Len (strText)
TmpStr=Mid (strText, k, 1)
If Asc (tmpStr) > 127Or 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 "Total number of characters: & All & chr (13) &" valid characters: & Sum & chr (13) & "Total number of Chinese characters: & c, 64, character Statistics"
End sub
TongJi () save the above code as TongJi.vbs, create an ok.txt text file in the same directory as TongJi.vbs, copy the text you want to count to ok.txt, and run TongJi.vbs to count the number of words, just like word. However, the algorithm is different and the result is not the same. The reason is how to understand what is a "valid character".
The above is all the contents of the article "how to achieve character Statistics in vbs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.