PowerShell for Windows Admins

Dec 12 2018   7:42AM GMT

Find duplicate characters in a string

Richard Siddaway Richard Siddaway Profile: Richard Siddaway


Staying with our current theme of manipulating strings this is how you find duplicate characters in a string.


Convert the string to a char array, group on the characters and use Where-Object to filter the characters that occur more than once – the duplicates. Sort the output for easier viewing.

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: