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
i am new QTP... please tell me automation frameworks , types & for whiich type of applications frameworks are used & how to generate script in keyword driven framework
i want information about API testing and i want info like how process can be done in company? i want added info like coding ,debugging, desing in c.v ? what should add in c.v for eg banking domin? pls any answer my question?
descriptive program for a yahoo mail that is in yahoo mail suppose check box mailid subject assume it is like this format all things are in webtable the question is suppose some mail ids are there in that mailids i want to select the check box wich is before a@gmail.com and after that i want to click on delete button
Define object spy ?
What are the different attributes used with regular expression?
What is the pros and cons between QTP and Rational Robot
if our qtp vb Script may be Currepted then What we want do?
how did u use automating testing tools in ur job?
Shall we add Local Repository to shared object repository,if yes,how we add
How can I import environment from a file on disk?
I have some real time based question.. 1.what are the challenges you have faced in your current project. 2.what are the bugs you found in your current project. 3.what are the strategies you follow to convert manual test cases into automation test cases. 4.how QTP identify two different browsers. 5. When you create a function library and share object repository what are the problems you have faced 6. How to solve the tool tip problem 7.what are the interesting bug you have found in your current project. 8.what is your daily work as a automation test engg. 9. how to create a weekly status report. 10. how many test cases you write,review and execute per day. 11.what are the uses of SQL in automation. 12.How to retrieve the data in html through vb script. 13.If application is very slow how to test the application in qtp.
If an application name changes frequently i.e while recording it has the name, in this case, how do qtp handles?
banking project description for software tester
How can I find out the cursor position through QTP suppose I am keep tabbing(Pressing the tab key continuously) and stoped at a position Now I want to find out where the cursor position is
What Folder Structure following in Keyword Driven Frame work?