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

Can we directly automate testscripts accrdoing to requirements? WHY ?

1 Answers  


Can any body help me to write descriptive program to find a cell value (say 2 row, 3rd column) in a datatable which is creating dynamically and statically

0 Answers  


What are the differences between quicktest professional (qtp) and winrunner?

0 Answers  


if i want to check text on the status bar how to test is i need the report also after getting the result weather it is matched or not?

2 Answers  


how many script you will wright in a year ? i told it's depends on the proj..and 'n.no of ... but he forced me to tell some num. or avg .....how many i suppose to tell..??and do a favor per day how many script don't thing it's repeated question or common ...help me post a ans...thanks for advance

1 Answers   HCL,






What is the main difference between desriptive programming and generic functions

2 Answers   HCL,


can any body tell me all of the release dates of QTP?????..... thanks in adv!

3 Answers  


we have 5 default properties we want add more Default property in Object Repository how to add the property

2 Answers   Nous,


how to select the work for complete automation and one more thing when u are going to choose automation

3 Answers   Fidelity,


what is objectidentification?

2 Answers  


Hi Can u plz suggest who is the Best Faculty for Advanced QTP Scripting in Hyderabad ,plz suggest me..... or send me a replay to satheesh.goli@gmail.com, r make me a call 9866335752

1 Answers   AppLabs,


How to pass parameters to Actions Pls anybody can give the answer.. Thanks in advance...

2 Answers   Navis,


Categories