PowerShell for Windows Admins

Dec 5 2018   10:22AM GMT

Count occurrence of characters in a string

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
Powershell

How do you count occurrence of characters in a string?

Group-object is a ready made cmdlet to answer this question

 

 

Split the string into a character array. Pipe into group-object using –NoElement to drop the data and sort the results in descending order.

 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: