TL;DR [char[]]$String

The first in a series of useful things in PowerShell.

The problem was how can I get all the characters in a string so I can process them. It’s not often needed, for example when converting between file formats, but when you do need it there’s little on the web on how to do it.

So I wrote a function, and as I wrote it the answer became obvious.

The name of the function ConvertTo-CharArray, and as PowerShell support type casting:

So in essence all you need is:

TL;CR [char[]]$String

--

--

Sebastian Rogers

Sebastian Rogers

43 Followers

Technical Director for Simple Innovations Ltd. First paid for code in 1980, but still has all his own hair.