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

wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......

0 Answers  


How are comments handled in the vbscript language?

0 Answers  


w r p syed then output was deys and click eysd and click ysde and click sdey and click deys and click eysd............

2 Answers   Cap Gemini, iGate,


Mention what is the use of option explicit in vbscript?

0 Answers  


what is the difference between modular and data and keyword driven framework

0 Answers  






How to Enter Values on the Command promt using VB script

0 Answers  


Can anyone help me in write coding to get this pattern * ** *** ****

3 Answers  


can anyone tell me the procedure of interview held in applabs

0 Answers  


Which event is triggered when mouse focus comes out of an element in the vbscript language?

0 Answers  


How to assign a numeric value to a variable?

0 Answers  


Write VB script to convert from feet to inches(hint 1feet=12 inches)

2 Answers  


How do you declare a variable in vbscript?

0 Answers  


Categories