How can I find out whether a word in a string is existed or
not
for example
"QTP IS A POWERFULL TOOL FOR AUTOMATION"
How can i find out whether "powerfull" is existed in the
above string or not
Could anyone answer it?

Answers were Sorted based on User's Feedback



How can I find out whether a word in a string is existed or not for example "QTP IS A POWE..

Answer / anshu

I think u just need to use

INSTR() that's it.

Is This Answer Correct ?    12 Yes 1 No

How can I find out whether a word in a string is existed or not for example "QTP IS A POWE..

Answer / naina

C = "QTP IS A POWERFULL TOOL FOR AUTOMATION"
msgbox Instr(1,c,"POWERFULL")

The result will be 10 , which is the position of the first
occurrence of the string POWERFULL

Is This Answer Correct ?    7 Yes 1 No

How can I find out whether a word in a string is existed or not for example "QTP IS A POWE..

Answer / sunil

Dim str,word

word=inputbox("enter the word for search")
str=inputbox("Enter a Sentence")
if instr(1,str,"word") then
msgbox "Searching word is present in the sentence"
else
msgbox"Searching word is not present in the sentence"
end if

Is This Answer Correct ?    3 Yes 0 No

How can I find out whether a word in a string is existed or not for example "QTP IS A POWE..

Answer / suresh

you fool nithya... y ur using FSO....and 10 lines of code...

this is too bad,,,,,
must use Instr
that s it

Is This Answer Correct ?    4 Yes 1 No

How can I find out whether a word in a string is existed or not for example "QTP IS A POWE..

Answer / prasoona

s="QTP IS A POWERFULL TOOL FOR AUTOMATION"
ss="powerfull"
If Instr(1,s,ss,vbTextCompare)<> 0 Then
msgbox ss&" exist in " &s
Else
msgbox ss&" is not exist in " &s
End If

Is This Answer Correct ?    3 Yes 1 No

How can I find out whether a word in a string is existed or not for example "QTP IS A POWE..

Answer / akshar jain

just assign that entire string to a variable & use either
instr or strcomp thats it

Is This Answer Correct ?    0 Yes 2 No

How can I find out whether a word in a string is existed or not for example "QTP IS A POWE..

Answer / nithya.m

Create a filesystem object . Read the file till the
letter "P" comes . After that Read till the length of the
word which you want to Check (In this case it is 9). then
compare the word with the word which you want to check
which should have been stored already . If the
stringcompare is true means, the word exists. Please go
through the following code for this example

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReadFile = objFSO.OpenTextFile("FILENAME" ,1)
Str="Powerfull"
Str1=objReadFile.ReadAll()
Set objReadFile_new = objFSO.OpenTextFile("FILENAME" ,1)
For i = 1 to len(Str1)
Str2=objReadFile_new.Read(i)
if Str2=Left(Str,1) then
Str3=ObjReadFile_new.Read(len(Str))
if Str3=Str then
Msgbox "FileExist"
Exit For
End if
Next

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More QTP Interview Questions

Explain the concept of object repository and how quicktest professional (qtp) recognises objects?

0 Answers  


How will you check a web application for broken links using qtp?

0 Answers  


i'm using QTP 8.2, How should i select(browse) object repository from desktop(or from local local drives like C:\,D:\)?. Note:- object repository to select(browse) is been sent by some other person who is using QTP 9.0

1 Answers  


How to handle run time errors?

9 Answers  


Other than using import sheet statement for importing the data from excel sheet, is there any other method that can be used?

2 Answers  






how to capture objects of remote deskop as it is capturing only window.

1 Answers   Wipro,


Hi, My name is kishan. I have good Conceptual Knowledge on QTP. In order to Boost up my Confidence Level, I want to do a Project oriented Training only on QTP in Hyderabad. Kindly Let me know which is the Best QTP Project Training Institute in Hyderabad. Thanks in Advance kishan

0 Answers  


What are the details steps to connect a remote mysql database in QTP

1 Answers   Verizon,


How to test the mandatory fields in QTP?

1 Answers   SoftSolve, TE,


Is QTP Supports SWT applications? If yes, can you write a sample script for opening a new package in eclipse.

0 Answers   IBM,


what is risks of testing a project?

5 Answers   AppLabs,


What is the registration process and examination fees?

0 Answers  


Categories