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 |
What do you do if QTP doesn't recognize object ,what action should be taken
How many types of recording facility are available in quicktest professional (qtp)?
How to handle the exceptions using recovery secnario manager in Qtp?
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?
Explain the concept of how QTP identifies object.
wht is Automation testing frame work. pls explain it
How to find operating system information using the qtp script?
Define object spy ?
i need qtp tutorial. pls send it to sridhar.k151@g mail.com
What is difference between the For..Next and While..Wend statements?
What are Add-ins availble in licensed version QTP8.2
what is difference betweem class annd object?