QTP Script to Count Number of Times a Word Appears in a Text File
Const ForReading = 1
Set fso = CreateObject( "Scripting.FileSystemObject" )
Set textFile = fso.OpenTextFile( "C:\qtp.txt", ForReading )
contents = textFile.ReadAll
textFile.Close
Set rgxp = New Regexp
rgxp.Pattern = "QTP"
rgxp.IgnoreCase = True
rgxp.Global = True
Set matches = rgxp.Execute( contents )
Msgbox "Count = " & matches.Count
QTP Script to Count Number of Times a Word Appears in a Text File-VB Script to Count Number of Times a Word Appears in a Text File
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment