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 QTP identify the system time that's changes every seconds?
I want to configure the OR and library files to a particular QTP test during run time. Note: OR and Library files are located in Quality Center. Is it possible in QTP? Anybody having code?
How will you compare keyword and expert view?
What are the benefits of qtp?
What is action split and the purpose of using this in qtp?
Some time when i wanna learn the object i face issue like i am not able learn the object in proper manner... eg:for text bo on web page it should learn as webedit but some times it reads as winobject:internetexpoler-server, because of this i have to uninstall the qtp and re-install it again when i do this it reads the object perfectly.....plz suggest the soln
How to save your test using quicktest professional?
Explain in brief about the quicktest professional automation object model?
How to use reporter.report event in qtp ?
How to sendKeys in QTP? Diff b/w sendkeys and device replay? Diff b/w function and Sub? Diff b/w Array and List Different Types of running Keys other than Fast, slow,Normal mode Regular expression for http://newtours.demoaut.com Difference between \w and \W How to generate script button Recording Types Different Types of Actions? Using DP performance degrades, If Yes why? How to close all the opened browsers? Diff b/w SystemUtil.Run and invoke application? If qtp not recognized the combo box How to select values from drop down?
can any body give the banking domain concepts/links
What is exact meaning of Database Checkpoint in QTP 9.2 and what are the different types of the database check points?
what is the diffrence bw qtp architectute and qtp framework?
What are the flaws in water fall model and how to overcome it?
1.Qtp suppots Unix& linx or not 2why qtp suppots shell script.