Quantcast
Channel: Scripting Blog
Viewing all articles
Browse latest Browse all 2129

PowerTip: Split String with PowerShell

$
0
0

Summary: Easily split a string on multiple characters with Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to split a string that contains multiple separator characters (for example, a comma and a semicolon)?

Hey, Scripting Guy! Answer Specify a string with the characters in it to the Split method:

PS C:\> $string = "This,is;a;string"

PS C:\> $string.Split(',;')

This

is

a

string


Viewing all articles
Browse latest Browse all 2129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>