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

Answers were Sorted based on User's Feedback



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..

Answer / hariharasudhan s

str1="1,1,2,2,3,3,4,2"
A = Split(str1,",")

For i = 0 to ubound(A)
IF A(i) = "1" then
Count1 = Count1 + 1
Elseif A(i) = "2" then
Count2 = Count2 + 1
End if
Next

Msgbox Count1
Msgbox Count2

Is This Answer Correct ?    5 Yes 0 No

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..

Answer / sisira

str1="1,1,2,2,3,3,4,2"
l=len(str1)
for i=1 to l
if mid(str1,i,"1")="1" then
count1=count1+1
elseif mid(str1,i,"1")="2" then
count2=count2+1
end if
next
msgbox count1
msgbox count2

Is This Answer Correct ?    2 Yes 0 No

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..

Answer / 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

More QTP Interview Questions

How many types of recording modes in qtp? Which will be used when?

0 Answers  


i am testing an online shopping application.I CLICK on a link "ADD TO CART" of that application a "new page" is open and then click on any object of that "new page". after that when i run this SCRIPT then on this "new page" QTP always shows error of "OBJECT NOT FOUND". How i solve this problem ?

4 Answers  


WHAT IS DIFFERENCE B/W QC 9.2 AND QC 10.0

1 Answers   SoftTech,


What is the difference between systemUtil and invoke method..?

5 Answers  


Can any one tell me about "Mapping Repository Parameter Values" and why we use it....??How to use it???Please, tell the preconditions also...........???? Thanks in Advance

0 Answers  






i want 8.2 and 9.2 dacuments plhelp any body sand it to my id sandhyat1@yahoo.co.in

3 Answers   Siloka,


How software automation specialist enter steps in the Expert View?

0 Answers  


Write a script to print below pattern 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5

2 Answers  


When I used random numbers(1 to 9) with regular expression and run the test, it runs only 5 iterations with passed result instead of running all 1 to 9. Please tell me what can be the reason

0 Answers  


how to re-install QTP 9.0 trial version.

25 Answers  


please send detail navigation for merging of object ripositories in QTP 8.2

3 Answers   Infosys, Ordain Solutions,


What r steps to migrate from Manual testing to QTP?(IN BOTH WEB BASED AND WINDOWS APP)

1 Answers   Wipro,


Categories