PowerShell for Windows Admins

Dec 28 2018   1:50PM GMT

Counting vowels

Richard Siddaway Richard Siddaway Profile: Richard Siddaway


If you’re given a string how would you go about counting vowels, consonants  and non-alphabet characters.

My approach would be:



The string to test is an input parameter.  Set up the output hash table and the byte value of the vowels.

Convert the string to lowercase and then to a char array which is put on the pipeline. Convert the char to a byte value and then use the switch statement to determine if its a vowel, consonant or non-alphabetic character.

Finally output the results.

 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: