Write a program to print all lines that contains a word either “testing” or “qtp”

Answers were Sorted based on User's Feedback



Write a program to print all lines that contains a word either “testing” or “qtp&r..

Answer / amit

''' Write a program to print all lines that contains a word either “testing” or “qtp”




Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")




Set objFile = fso.OpenTextFile("C:UsersAmit MoolchandaniDesktop est.txt",1,True)












Do While objFile.AtEndOfStream <> True
str = objFile.ReadLine
If Instr(1,str,"Testing",1) Or Instr(1,str,"qtp",1) Then
Print str
End If




Loop




objFile.Close




Set objFile = Nothing
Set fso = Nothing

Is This Answer Correct ?    5 Yes 0 No

Write a program to print all lines that contains a word either “testing” or “qtp&r..

Answer / syamala usha

set fso = createobject("scripting.filesystemobject")

set f=fso.opentextfile("C:
otes HP.txt",1)


Do until f.atendofstream

str=f.readline

a = split(str," ")

flag=0

for j = 0 to ubound(a)

if (a(j) = "testing") or (a(j) = "qtp") then

flag=1

exit for

end if

next

if flag=1 then

msgbox str

end if

loop

f.close

set f= nothing

set fso =nothing

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More VB Script Interview Questions

how to display all the links in one page using vb script in qtp.

1 Answers   DST Global Solutions,


How can you test font size, type and color using QTP tool?

3 Answers  


What is the difference between VBScript and JavaScript?

0 Answers  


how to write vb script code for login gmail page by using notepad and how to run script in notepad

1 Answers  


a function that takes an integer array as an argument and returns the largest value in the array. Use the function in a program

1 Answers  






What is the extension of the vbscript file?

0 Answers  


Explain sga memory structures?

0 Answers  


What are the data types supported by vbscript?

0 Answers  


if u ve resrevation for train and u get a number supose 1234xxxokie.after sucessul entering all required fields. now u put that number in search and want to chk wether these ar same or not if both ar same then its okie otherwise test fail.what would be the vb script code for it to compare these two values of different page.

0 Answers  


Is vbscript language a case-sensitive language and what does it mean?

0 Answers  


What is vbscript procedures?

0 Answers  


Which conditional statement is the most convenient one to use in the case of multiple conditions in the vbscript language?

0 Answers  


Categories