PowerShell: Convert String To Array

In December I had fun solving the “riddles” at Advent Of Code and a large number of them (starting with number 1) had strings for input that needed to be parsed. So, posting this for myself, cause I can never remember it….

Convert a string to an array of single characters

The output:

powershell_string_array_1

Convert a string into an array of words

powershell_string_array_2

Convert a string based on arbitrary characters

This also works with regular expressions…

powershell_string_array_3

2 thoughts on “PowerShell: Convert String To Array

Leave a Reply

9b650548386f203b042d970d8bb4c0b3eeeeeeeeeeeeeeeeeeeeeeeeeee