The string is like POWER STAR PAVAN , write a script for
this how to findout the number of "A" in the string ?
Answers were Sorted based on User's Feedback
Answer / uday
str="POWER STAR PAVAN"
counter=0
For i=1 to len(str)
strChar=mid(str,i,1)
If strChar="A" Then
counter=counter+1
End If
Next
msgbox counter
Is This Answer Correct ? | 17 Yes | 0 No |
Dim oArray
Dim ochr
oStr="POWER STAR PAVAN"
ochr="A"
oArray=split(oStr,ochr)
print ubound(oArray)
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / ram
str="POWER STAR PAVAN"
len1=len(str)
str=replace(str,"a", "")
len2=len(str)
a=len1-len2
msgbox a
Is This Answer Correct ? | 6 Yes | 5 No |
Answer / goms
Val="POWER STAR PAVAN"
If instr(Val,"A")>0 then
Msgbox "Pass"
Else
Msgbox "Fail"
End IF
Note: If instr function returns the position of the value.
If it is greater than 0, the letter is in the particular
variable
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / madhulika
function VerifyLetters(S_String,S_Pattern,MatchStr)
Set OReg = new RegExp
Set S_Pattern = OReg.Pattern
OReg.IgnoreCase = True
OReg.Global = MatchStr
Set Matches = OReg.Test(S_String)
MatchFound = Matches.count
VerifyLetters = MatchFound
End Function
-------------------------------------
val = "Power star pavan"
'Calling function
msgbox VerifyLetters(val,"A",True)
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / seru
str="POWER STAR PAVAN"
Number_of_A=Len(str)-Len(Replace(str,"A",""))
msgbox Number_of_A
Answer is 3
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ravi
str="POWER STAR PAVAN"
len1=len(str)
msgbox len1
str=replace(str,"A", "")
len2=len(str)
msgbox len2
a=len1-len2
msgbox a
Is This Answer Correct ? | 1 Yes | 3 No |
for a test in QTP i had choose the object repository as shared.after completion of some days i want to conduct the same test again,now the question is HOW TO LOAD THE OBJECT REPOSITORY. is it possible by descriptive programming.could any one tell me how many ways we load it and what is the process?
can we call a test in another test? how? explain with one example?
What is QuickTest Automation Object Model? Where we can use AOM?
When u r running a script , if u get a popup window that describing that u have received a mail to your outlook application. so to avoid the interference of the popup window , which recovery scenario(popup,object state,application hang,system crash) would u use ?
Hi, I want to write the script for a webpage. But i didn't added the properties of the objects to the object repository. Without adding the object properties to the object repository, how to write the script. When i am writing the script, Let us say i typed as Browser (""). after selecting ".", if the object is added to the object repository it will display atomatically. But in my case it is not as i didn't added the object properties. How to proceed further in the above mentioned case to write the script manually. Pls let me know if you didn't understand the question.
How i can use Regular expression in QTP?give detailed steps for it.
What is the limitation to XML Checkpoints?
Hi, I am supposed to automate mainframe application through qtp. I do not know how to start abt it. Can you plz help me in first initializing the process or do you anybody have a guide book or a link which guides me through the process of automating the mainframe applications and things involved in it.
How to get the column count and column name from the resultset in the database connection program?
How to add check point?
HOW CAN WE GET THE VALUE OF TEXT BOX IN QTP? can you give me sample script for this where there is some condition. like if "text" THEN msgbox() else endif
How to identify the objects using descriptive programming when the object property values are same, i mean in a page 10 objects are there i want to click the 6th object but all the object property values are same? using descriptive programming