PowerShell One-Liner: Strings to Arrays and Back Again
I'm (just) a old-school Perl hacker and miss their join() and split() functions. Turns out, while PowerShell doesn't have them, .NET does, to a point.
PS> $home.split("\")
C:
Users
timid
And the other way around.
PS> [String]::Join("|", $(gci))
Contacts|Desktop|Documents|Downloads|Favorites|Links...
I always forget about the class methods.
The <[string]>.split(char[]) isn't as powerful as Perl's. We can't split on RegEx, though we can specify multiple delimiters as an @('a','r','r','a','y').