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 to start recording using quicktest professional?
How many types of recording modes in the qtp?
To retrive the test data which tool vl use and whats basis u vl write test data? its urgent
your coming from electrical backgroung..but y ur coming to software side?
How may types of defects identify application or your currently working application?pls give me answer..
What is debugging? How you debug your script?
How to test the login page in different ways in automation testing and i need code?
What are benefits of qtp?
wht type of User defined functions or Java Releated functions Do we write in VB scripting
How can you identify the browser and its information using QTP script?
How to handle the exceptions using recovery secnario manager in quicktest professional?
How to customize qtp?
I want to write some certification courses, so friends could you guide me? which certification is best and how to write exam and what tutorials need to be studied,what to do first, I am working on automation tool QTP 9.2
How to create a standard checkpoint ?
How can i initiate the objects to find uniquely in OR