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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I check if a environment variable exist or not?

636


Dear Friends, I having total 3+year experience in manual testing including automation testing QTP, if i am attending any interview what kind of question will i get? please help me out

1680


Explain the types of object repositorys in qtp?

659


what are the challenges you have faced while testing web based application using the automation tools ?

689


can i compare two databases using QTP ?

1999






We stored into the objects OR and then write the scripting

1630


How can i click on any Excel sheet's "H" column with out writing coordinates Ex:Window("Book1").WinObject("Book1").Click 498,14 I dont want to give coordinates like 498,14 Can i open "H" column by writing like Ex:Window("Book1").WinObject("Book1").Click "H" or Ex:Window("Book1").WinObject("Book1").Click "H","1" or Ex:Window("Book1").WinObject("Book1").Click H,1 If i want to click on "Sheet3" of an excel sheet, Can i open like Ex:Window("Book1").WinObject("Book1").Click "Sheet3" Please help me any one

1709


What does mean by Scope of Automation?n How we defined it?

1655


Hi, i run scripts in one machine those r passed.when i run the scripts in client side those r failed.Give me such a scenario when ever u faced?

1617


if numbers are always changing write a script for that

3579


how can i sent QTP results to the Html, notefile ,xl file give me the code using g mail login page

1914


Explain the features of quick test pro(qtp)?

669


How do you synchronization point through DP?

705


What is the recovery scenario in qtp?

659


Can we call qtp test from another test using scripting. Suppose there are 4 tests and I want to call these tests in a main script. Is this possible in qtp?

731