write vb script code to delete the duplicate values in an
array.
Answers were Sorted based on User's Feedback
Answer / guest
dim a
aList=Array(5,5,5,5,12,10,15,10,125,5)
Dim sNewList
dim newArray
b= ubound(aList)
For x=0 to b
If InStr(sNewList,(aList(x) & ",")) <= 0 Then
sNewList = sNewList & aList(x) & ","
End If
Next
newArray = split(sNewList,",")
MsgBox sNewList
Is This Answer Correct ? | 37 Yes | 10 No |
Answer / saket bharti
aList=Array(5,5,5,5,12,10,15,10,125,5,1,1,2,3,4,5,6,7,8,8,8,8,8,8,8)
ReDim newArray(UBound(aList))
count=1
newArray(0)=aList(0)
for i=0 to UBound(aList)
temp=aList(i)
flag=0
for j=0 to UBound(newArray)
if ( newArray(j)=temp) Then
flag=1
End if
Next
if flag=0 then
newArray(count)=temp
count=count+1
End If
Next
ReDim Preserve newArray(count)
for j=0 to UBound(newArray)-1
msgbox newArray(j)
Next
Is This Answer Correct ? | 9 Yes | 1 No |
Answer / 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 |
Answer / bhaskar sarma
Input = Array(6,6,6,7,6,75,78,75,75,6,66,6.6)
count = 0
arr = ","
for Bye =0 to ubound(input)-1 step 1
for Hello=Bye+1 to ubound(input) step 1
if strcomp(Input(Bye),Input(Hello),1)=0 AND instr(1,arr,Input(Hello))<=0 then
count = count + 1
arr = input(Hello) & ","
exit for
end if
next
next
msgbox count
Is This Answer Correct ? | 0 Yes | 0 No |
What are the different scripting languages you could use when working with QTP ?
Pls can anyone give me the descriptive programing script to find the number of edit boxes in a login window in flights reservation (windows application only not web). Pls anyone, very urgent
how will load the object during runtime?
How can I map test requirement to Test Set (multiple test cases)? Under test lab, I have multiple test cases. I would like to map 1 requirement to all test cases under that test set (in test lab)? Currently, I think QC only allow mapping 1 test requirement to 1 test case. Instead I would like to map 1 test requirement to multiple test cases under one test lab.
4 Answers CarrizalSoft Technologies, DST Global Solutions,
A FORM CONTAINS 5 FIELDS. 1 FIELD IS ENABLED REMAINING(4) FIELDS DISABLED. MY QUESTION IS ENTER VALUES INTO 1 FIELD AFTER THAT CLICK TAB BUTTON THEN 2 FIELD ENABLE THIS PROCESS CONTINUE UPTO 5TH FIELD. HOW TO WRITE CODE IN DESCRIPTIVE PROGRAMMING. PLZ TELL ME THE PROCEDURE AND CODE FOR IT.
Hi, How to invoke QTP or any application through Command Prompt without using Vb script and batch file.... Reply me Srinivas
What are the various types of Actions in UFT?
w is descriptive programming
What is descriptive Programming in qtp.
what is the smart identification techniqu?what r the different mechanisums used in it?
what is the data driven testing?
what is the difference between DATA TABLE and DATA SET?