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
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 |
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 |
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 |
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 |
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 |
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 |
How to count the no of objects in XML file(QTP)
how can we group that these test cases only should be automated and in which order you execute that test cases
What is AUT in object reposity in QTP? Why we use it in Object repository???What is full form???????
What are the main differences of qtp and win runner?
suppose 3 excel sheets are there * we are trying to check for login credentials for a page. userid from excel1 , password is from excel2 whether the page is opened or not that checkpoint is result is should be stored in excel 3.... this qus i have faced in IBM technical round... please tell script for above query
What are the different scripting languages you could use when working with QTP ?
There is a very good institute for Automation Testing using QTP.For more details please visit jbslearnings.com.
Explain about Hybrid Framework
Is it possible to change the property value at runtime? How it is possible?
Explain different types of checkpoints?
Which object model is not supported by QTP? a)COM b)DECOM c)DOM d)DCOM. Pls explain about theese object models?
how to write script in qtp(vbscript)..i mean with out application deployed..and how to call script1 into script2?
8 Answers INCA, Infosys, Logix, SLK Software, Symphony, Wipro,