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 |
Is QTP supports Unix. If yes, then how the test automation is done?
Hi, Can anyone help me in esimating time for an application using QTP tool.. What factors should be considered while calculating the estimation time for QTP... Thanks in advance... Prasad Gali
What is qtp window?
1. Can anyone help me with recovery scenarios, each type with examples and also what is on error resume next?
How to save your test using quicktest professional?
Is the provision for integrating QTP with QC ,available from the version 9.0 onwards only or even 8.2 version has such provisions?
When do go for loop condition in test?
Where you are storing your script?
What is the short cut keys for the following?
How to add a standard checkpoint in your test ?
Hi Guys, I want to place all of my values which i am getting it from a loop in to a global shee. For that i had written the script like this For i = 1 to ECOs-1 ECO = List(i).GetROProperty("innertext") DataTable.AddSheet("ECOList") DataTable.GetSheet("ECOList").AddParameter "ECOList",ECO AbortECO = DataTable.GetSheet("ECOList").GetParameter ("ECOList").Value msgbox AbortECO DataTable.GetSheet("ECOList").SetNextRow Using the above script, whenever the loop iterates it is creating new column "ECOLIST" in the sheet called "ECOLIST". It means, the values are displaying in the column wise even though i added the script " DataTable.GetSheet("ECOList").SetNextRow" . The cursor is not moving to the next line. Anybody help me out how to pass the values from script to the excel(Global/Local) sheet. Pls let me know @ nbabu11@gmail.com if you are not clear about the question.
How should i get name of the screen? Ex:There is a "submit" button.If i clicked on the submit button it opens a screen. I want that screen name.How can i get that screen name I dont have any property regarding that screen. If suppose we cliked on the screen , Then QTP captures the screen properties then i can get the screen name by using GETROPROPERTY But i want the screen name without clicking the screen. ("I am using the "settoproperty" for Second screen by using fist screen properties") Please tell me anyone