Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Created Jul 11, 2021
Embed
What would you like to do?
Function RemoveDupeChars(text As String) As String
Dim dictionary As Object
Dim char As String
Dim result As String
Set dictionary = CreateObject("Scripting.Dictionary")
For i = 1 To Len(text)
char = Mid(text, i, 1)
If Not dictionary.Exists(char) Then
dictionary.Add char, Nothing
result = result & char
End If
Next
RemoveDupeChars = result
Set dictionary = Nothing
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment