I have string $x
from a TextBox:
I want to split this string to an array of strings without the '*'.
I run: $a = $x.Split("*")
but I received double spaces in the "7-zip":
Suggestion 1:
Here they suggested to user -split
but when using it I received a string (array of chars), not an array of strings:
Suggestion 2:
In this blog and on this question they suggested to use [System.StringSplitOptions]::RemoveEmptyEntrie
+ foreach
(in the blog) in order to parse the un-wanted spaces.
I tried:
$option = [System.StringSplitOptions]::RemoveEmptyEntries
$b = $x.Split("*", $option) |foreach {
$_.Split(" ", $option)
}
How can I split a string to an array of strings separated by "*" ?