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



The string is like POWER STAR PAVAN , write a script for this how to findout the number of "A&..

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

The string is like POWER STAR PAVAN , write a script for this how to findout the number of "A&..

Answer / pavani prasad naidu

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

The string is like POWER STAR PAVAN , write a script for this how to findout the number of "A&..

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

The string is like POWER STAR PAVAN , write a script for this how to findout the number of "A&..

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

The string is like POWER STAR PAVAN , write a script for this how to findout the number of "A&..

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

The string is like POWER STAR PAVAN , write a script for this how to findout the number of "A&..

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

The string is like POWER STAR PAVAN , write a script for this how to findout the number of "A&..

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

Post New Answer

More QTP Interview Questions

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?

13 Answers   Logica CMG,


can we call a test in another test? how? explain with one example?

1 Answers   iFocus,


What is QuickTest Automation Object Model? Where we can use AOM?

1 Answers  


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 ?

4 Answers   Accenture,


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.

3 Answers  






How i can use Regular expression in QTP?give detailed steps for it.

2 Answers  


What is the limitation to XML Checkpoints?

0 Answers  


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.

0 Answers  


How to get the column count and column name from the resultset in the database connection program?

6 Answers  


How to add check point?

2 Answers  


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

7 Answers   Xavient,


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

2 Answers   Genpact,


Categories