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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain sub procedure of vbscript.

580


hi i am working with vbwindow on qtp.first i am openning qtp whenever open qtp my application not open that time generated error like "Runtime error 0" and fatal error:automation error how to solve this problem pls tell me

1863


Does QTP10 supports Windows 7OS +IE 9 combination? Which is the preffered combination ,Plz let me know?

2964


What is difference between shared and local object repository?

580


Thanks....But can u tell me how i use the QTP for GIS with one Example...

1421






Write a script to verify font style and color of a windows object using descriptive programming

829


Write the code for,In the page screen we have total 10 Links,out of these I have to click 9th link

860


What is test object?

689


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

1590


What are parameterizing tests?

541


Explain the types of properties that quick test learns while recording?

552


How to remove the associated function library?

523


Which features or drawbacks of QTP lead to the upgrade for a newer version?

562


How to associate shared object repository to test in qtp?

496


How many types of recording facility are available in quicktest professional (qtp)?

594