October 1st, 2014

PowerTip: Use PowerShell to Create Hash Table to Hold Lowercase Letters

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to create a hash table that holds all ASCII lowercase letters.

Hey, Scripting Guy! Question How can I use Windows PowerShell to create a hash table that holds all lowercase ASCII letters?

Hey, Scripting Guy! Answer Create an empty ordered dictionary, and then use the add method to add the numbers 97-122
           as keys and the [char] associated with the number as the value, for example:

$a = [ordered]@{}

97..122 | foreach-object {$a.Add($_,[char]$_)}

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback