Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Created July 11, 2021 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndthanh/bb9b2679c09a14c871be12444934b971 to your computer and use it in GitHub Desktop.
Save ndthanh/bb9b2679c09a14c871be12444934b971 to your computer and use it in GitHub Desktop.
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