write vb script code to delete the duplicate values in an
array.
Answer Posted / jay prakash
There are many ways this script can be written.
One simple algo which i followed was:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''Script Starts Here'''''''''''''''''''''''''''''''
Option Explicit
Dim i, j, k, aMyArr, aNewArr( ), iNewIndex, iNewLim, bFlag
bFlag = 0
aMyArr = Array("AA","BB","AA", "BB" )
iNewIndex = UBound(aMyArr)
ReDim aNewArr(0)
aNewArr(0) = aMyArr(0)
For i=0 To UBound(aMyArr)
iNewLim = UBound(aNewArr)
For j = 0 To iNewLim
If aMyArr(i) = aNewArr(j) Then
bFlag = 0
Exit For
Else
bFlag = 1
End If
Next
If bflag = 1 Then
k=iNewLim+1
ReDim Preserve aNewArr(k)
aNewArr(k)=aMyArr(i)
End If
Next
' To display the new array...
For i = 0 to UBound(aNewArr)
msgbox aNewArr(i)
Next
Erase aMyArr
Erase aNewArr
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''Script Ends Here'''''''''''''''''''''''''''''''
Please let me know if it satisfies ur query.
Is This Answer Correct ? | 9 Yes | 4 No |
Post New Answer View All Answers
how we connect 1. qtp9.2 to the quality center9.0? 2. Load runner8.0 to the quality center9.0
How to Test the mainframe application?
What are the two types of repositories available, explain them?
How to add verification steps to tests?
Explain about the quicktest professional (qtp) automation object model?
How do I lauch my test website using code from qtp in different environmet, uat and PPTE?
In a flight window we have to enter the name and meal request for every passenger.In that window if we give Total passengers=1 then the Psngr1 name field and psngr1 meal request field will reflects.if we give Total passengers=2 then Psngr1 name field and psngr1 meal request field,Psngr2 name field and psngr2 meal request field will reflects and so on.if total psngrs=100 then will we capture all the fields for the psngrs to Automate the app how we can handle this scenerio thru Descriptive programming?
explain how to write vb script in qtp?when will you write own script?
hi i have completed my b.tech in cse stream. now i am working in an organisation in testing department. i want do sap course but i dnt know which module will boost my career can anyone suggest me which is good for my career
How the exception handling can be done using quicktest professional?
In qtp, how you can get the last character from a string?
If a button named "CLICK" is recorded in low level recording mode , what will be the values stored for "name" property of that button in object repository ?
How to interact tool & application build in QTP?
Which recording modes need more memory?
When using descriptive programming?