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

What do you do if QTP doesn't recognize object ,what action should be taken

11 Answers   Lehman Brothers,


How many types of recording facility are available in quicktest professional (qtp)?

0 Answers  


How to handle the exceptions using recovery secnario manager in Qtp?

2 Answers  


PLS REAL TIMERS WRITE THE ANS FOR THIS? WHICH SCRIPT IS USED IN REAL TIME NOW A DAYS 1)SHARED REPOSITORY BASED SCRIPT 2)DESCRIPTIVE PROGRAMMING BASED SCRIPT?

1 Answers  


Explain the concept of how QTP identifies object.

5 Answers   Ordain Solutions,


wht is Automation testing frame work. pls explain it

3 Answers   Wipro,


How to find operating system information using the qtp script?

0 Answers  


Define object spy ?

0 Answers  


i need qtp tutorial. pls send it to sridhar.k151@g mail.com

0 Answers  


What is difference between the For..Next and While..Wend statements?

2 Answers  


What are Add-ins availble in licensed version QTP8.2

1 Answers   TCS,


what is difference betweem class annd object?

1 Answers  


Categories