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 |
Can we directly automate testscripts accrdoing to requirements? WHY ?
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
What are the differences between quicktest professional (qtp) and winrunner?
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?
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
What is the main difference between desriptive programming and generic functions
can any body tell me all of the release dates of QTP?????..... thanks in adv!
we have 5 default properties we want add more Default property in Object Repository how to add the property
how to select the work for complete automation and one more thing when u are going to choose automation
what is objectidentification?
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
How to pass parameters to Actions Pls anybody can give the answer.. Thanks in advance...