LalithaPrabu
Programmer
When there is no Delimiter to find Duplicate letters in String in VB6 -tried the below one. Is there any easier method than this?
Function RemoveDuplicateLetter(ByVal MyString As String) As String
On Error GoTo vbErrorHandler
Dim MyArr As Variant, MyNewArr() As String, X As String
Dim bValue As Boolean
Dim i As Long, j As Long
Dim str As String
For i = 0 To Len(MyString)
str = str & Mid$(MyString, i + 1, 1) & vbNullChar
Next
i = 0
MyArr = Split(str, vbNullChar)
ReDim MyNewArr(0)
MyNewArr(0) = MyArr(0)
For i = LBound(MyArr) To UBound(MyArr)
bValue = True
For j = i + 1 To UBound(MyArr)
If MyArr(i) = MyArr(j) Then
bValue = False
Exit For
End If
Next
If bValue Then X = X & " " & MyArr(i)
Next
RemoveDuplicateLetter = X
Exit Function
vbErrorHandler:
End Function
Function RemoveDuplicateLetter(ByVal MyString As String) As String
On Error GoTo vbErrorHandler
Dim MyArr As Variant, MyNewArr() As String, X As String
Dim bValue As Boolean
Dim i As Long, j As Long
Dim str As String
For i = 0 To Len(MyString)
str = str & Mid$(MyString, i + 1, 1) & vbNullChar
Next
i = 0
MyArr = Split(str, vbNullChar)
ReDim MyNewArr(0)
MyNewArr(0) = MyArr(0)
For i = LBound(MyArr) To UBound(MyArr)
bValue = True
For j = i + 1 To UBound(MyArr)
If MyArr(i) = MyArr(j) Then
bValue = False
Exit For
End If
Next
If bValue Then X = X & " " & MyArr(i)
Next
RemoveDuplicateLetter = X
Exit Function
vbErrorHandler:
End Function