Dim FileContents As String = My.Computer.FileSystem.ReadAllText("C:\Temp\Temp.TXT")
Dim LinesFound As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(FileContents, "\n")
Dim WordsFound As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(FileContents, "\w+")
Dim NumberOfLines As ULong = LinesFound.Count
Dim NumberOfWords As ULong = WordsFound.Count
Dim NumberOfCharacters As ULong = FileContents.Length
Tips and tricks for .NET using ASP and VB code.
Get the number of lines, words and characters in a text file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment