Hi,can anyone tell me How to found the number of 1's and 2's in the given format 1,1,2,2,3,3,4,2 using vbscript
Thanks in advance

Answer Posted / rajesh

str= "1,1,2,2,3,3,4,2"
arr = split(str,",")
for i =0 to ubound(arr) step 1
if arr(i) = "1" then
counter = counter + 1
elseif arr(i) = "2" then
counter1 = counter1 + 1
elseif arr(i) = "3" then
counter2 = counter2 + 1
elseif arr(i) = "4" then
counter3 = counter3 + 1


end if
next
msgbox "No of 1's :- " & counter
msgbox "No of 2's :- " & counter1
msgbox "No of 3's :- " &counter2
msgbox "No of 4's :- " &counter3

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I have qtp 9.5 demo ver,I am not able to record the yahoo broeser.so anyone can tell me what setting i have to do in QTP for yahoo brower recording. why its not recognise the object of yahoo browser????

2144


What is the syntax to call one action in another?

541


Why bpt?

586


hi guys, pls tell me for testing institution training hub, hitech city is best or not?

1309


How to creating an output value using quicktest professional (qtp)?

558






What are the major/ important methods, functions in QTP we use realtime testing

2257


Explain building blocks of the bpt framework ?

551


How can you give wait up to 10 seconds in qtp?

584


What are the types of object repository in qtp?

557


How QTP identify the system time that's changes every seconds?

587


HOW AUTOMATE TEST SCRIPT ? what time it will do? after gneration of basic script or Any , Plz explain detailed?

1708


How does QTP identify an object?

604


banking domain description for software tester for interview

3457


What the differences are and best practical application of Object Repository?

579


Why qtp the best testing tool?

558