Monday, November 23, 2015

How to remove duplicates values in array in qtp

Removing Duplicate Digits

dim a
aList=Array(12,10,15,10,125,7)
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

MsgBox sNewList

Removing Duplicate Char


str = "guruprasad"

Dim sNewList
For i =1  to len(str)
strChar = Mid(str,i,1)
   If InStr(sNewList, strChar) <= 0 Then
       sNewList = sNewList&""& strChar
   End If
  Next

MsgBox sNewList

No comments:

Post a Comment