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 |
who is the best faculty in Hyderabad for QTP?
what is a test strategy & what is the difference between test strategy & test plan?
For what purpose to we use object repository in a application?also explain usage of obj.repository?
What is the Diff between Image check-point and Bit map Check point?
actuall wat my doubt is:while doin regression testin we enter all +ve & -ve data....system has to accept +ve and reject -ve data.in such case we get a popup window sayin that wrong entry...now i wan to overcome this popup window..how do i go further....plz explain.i tried thru rec.scenario but of no use.
Hi All, I want to know how can we schedule QTP scripts. Am using 9.5 version and in our office they want to schedule individual scripts of QTP so that it can run unattended during night time, Please help me how to do that. 2. what is the use of silent test run in qtp can I schedule the scripts in Silent runner, Please explain. 3.I retrieved data from the database using output value -> Database output value. the result of the query for eg is 5 rows, iam able to output the first row by selecting the cols and adding it to output, but am not able to do it for the rest of the rows. please tell me how to do it. Sorry for posting so many qns, am not able to find answ to any of the above in any websites, hoping that someone would really help me with these here, please help me. awaiting for ur immediate revert. Priya
tell me abt a time when u had to go above &beyind the call of duty to get the job done
Can any one tell the different properties and values of differnt objects like Browser,Page,link,webedit,webcombobox,webradio botton,webcheckbox and web button.Because I am facing a lot of problems in interviews with Descriptive Programing.I never worked on web Application...Pls help any one as soon as possible....
what is risks of testing a project?
Hi All, issue is related to handling pop up script generated in IE, and run on mozilla. In App Under Test, when we get the alert pop ups, we just click ok button. if we need to run the same code on mozilla it will not identify . so we will check browser if browser(*).dialog(IE object).exits browser(*).dialog(IE object).winbutton(OK).click else 'by default mozilla browser(*).dialog(mozilla object).page(*).webbutton(OK).CLICK END IF But my qustion is. Do we write the above piece of code where ever we get such kind of pop ups from the application like alert pop up, confirmation pop up.... OR do we have any other alternative way to do this by using any functions in Recovery Scebarios? If Any of u know idea please do help me in this regard. or send answer to kravimb@gmail.com
What is the extension of 'Log file' in QTP
Could you please any body help me.for example in web table in the first row and first column there are 3 links like l1,l2,l3 having indexes 0,1,2 but second time links will change their order like l2,l3,l1 and indexes also changed how can we handle this situvation with script....