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

hello all i need some good sites or blogs which give info abt vb script with examples n real time scenarios.just like tutorials as i m new to qtp n vbscripting. its urgenttt

2 Answers  


write a qtp script to enter user name & password for flight reservation login page from excel sheet

1 Answers  


What is iteration? How it is related to Test Results in QTP

3 Answers   Virinchi Technologies,


i am giving.multiple names like ram,raj,san etc....pls enter & search these names in google pade edit box through script... i told to interviewer, using Ms excel & test easily..but interviwer not happy with that answer?

2 Answers   Accenture,


in a web page How to check and display a particular word from a paragraph?

0 Answers  


hai, i completed my b.tech in 2010 with 62.3%. i having knowledge on manual testing and Qtp. i want Relavent experience in testing.watever may be d salary i dont bother..I just want to gain knowledge. i dont have good communication skills.

0 Answers  


What is the process for creating an automated test script using QTP assuming you have reviewed the manual test case and understand the requirements?

1 Answers   Infosys,


what is syncurnisation point? what is the use of this in real time environment? plz explain?

6 Answers   AppLabs,


Can i get a simple example exercise for update run mode for sample flight application......... In qtp when i try to run the test in update mode.. Auotmation> update option is disabled............ Pls let me know ................. Thanks in advance.....

3 Answers  


how we implement share object repository in QTP 9.0 without using quality Centre , Explaine in brief

0 Answers   HCL,


What is output value?

3 Answers   Ordain Solutions,


Hi we are running tests remotely from quality center and pushing tests into qtp boxes remotely, and it does execution but while uploading results back into quality center it hangs in qtp box.If any one come across similar problem, please send me details how to handle this. Thanks kris

0 Answers  


Categories