[char[]]$Delimiters = @(';', ',', "`t")
So this works well with the "Split" command. For example:
[char[]]$Delimiters = @(';', ',', "`t")
[string]$String = "One,Two;Three"
[array]$NewArray = $String.Split($Delimiters, [StringSplitOptions]'RemoveEmptyEntries')
Write-Host "The String:"
$String
Write-Host "The New Array:"
$NewArray
Would produce the following output:
The String:
One,Two;Three
The New Array:
One
Two
Three
No comments:
Post a Comment