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

assume i have few url link how will i dynamically call then using descriptive programming?

0 Answers   BirlaSoft,


What is accessibility check point?

0 Answers  


What are the Disadvantages of shared object repository?

0 Answers  


CAN SOME ONE TELL ME ABOUT QTP FRAMEWORK? I AM SUPPOSED TO GIVE THE QTP FRAMEWORK THIS WEEK SO PLEASE HELP

2 Answers  


Plz explain about InTERNAl Environment variable, External environment variable,builtin environment variables with examples?

1 Answers   TCS,






what are the parameters you are considering for object identification?

1 Answers  


Is there any thing that we can replace recovery scenario manager in QTP.

3 Answers  


Hi, I have 2 dropdown listboxes called region and city/area. It needs to select one region(Santa Clara) and one city/Area (Sunnyvale).So I put this in the for loop and I am storing the Items in the variable called itemname. The regions value will get changed,so I used reg expression for this regions. This is my code Browser("MLSListings.com").Page("MLSListings.com").Link("» County/Area").Click Browser("MLSListings.com").Page("MLSListings.com").WebList ("regions").Check CheckPoint("regions") ListSize=Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").GetTOProperty("items count") For i = 1 To ListSize-1 Itemname =Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").GetItem(i+1) Browser("MLSListings.com").Page("MLSListings.com").WebList ("regions").Select Itemname ................. If I run the script,I am getting the following error, Cannot identify the specified item of the regions object. Confirm that the specified item is included in the object's item collection. Any Help? Thank you, Uma

0 Answers  


How Exactly we can find out the INDEX No. of any object of an application when we test that application in QTP? Explain this by giving me the example of all LINKS of G-Mail (including home page, User-account page and all possible pages you ever seen in G Mail)?????? and if your answer is that as per appearance of objects(LINKS) in application we can find out the index number in application then tell me how you find out which object(LINK) having INDEX No. 1,2,3 and so on and how you say which object(LINK) is appeared first and which is last?

4 Answers   Infosys,


in order to start automation testing what we should require (entry level to automation testing)

2 Answers  


What is the ur roles and responsibilities as automation testing engineer?

2 Answers   Atos Origin,


Give me detailed theritical explanation about keyword driven, hybrid framework, environment variables, hybrid frame work

0 Answers   TCS,


Categories