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
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 |
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 |
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 |
How to Analyze the Checpoint results by Text/Text Area Checkpoint?
What are the Mandatory Properties of WebTable Object and Link Object in Web testing using QTP
why do we go for Test Automation?
How to get the format of a webedit class in qtp. How can i know that particular webedit accept what type of format like "mm/dd/yyyy" or "$" or Alphanumeric
What is the extension of script and object repository files in QTP?
write a test script in QTP to test the text that written in an image(i.e jpg)of a web page???
list me out the shortcutkeys for some functionlities in the qtp for example to record ,to run ... etc
Explain the concept of how quicktest professional (qtp) identifies object?
I want to check in the data table(Globalsheet) column exist or not through script .If column not exist only proceeded to next step Pls tell me how to proceeded?
How do you open adobe acrobat file in QTP and do some testing on that file ?
Explain Different types of Checkpoints in Quick Test Professional?
What is test object model in QTP ?