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:


Convert a string into an array of words


Convert a string based on arbitrary characters

This also works with regular expressions…


4 thoughts on “PowerShell: Convert String To Array”

Leave a Reply