$string = @(
“Adolf-Kolping-Weg, KG Mühlau (Mühlau-Dorf)”
“Adolf-Pichler-Platz, KG Innsbruck (Innenstadt)”
“Ahornhof, KG Pradl”
“Aldranser Straße, KG Amras”
“Algunder Straße, KG Amras”)
When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
( !! Sometimes the preformatted text button hides behind the settings gear symbol. )
… now … to your question … what is it actually what you’re trying to achieve?
In generall I’d recommend to stick with the PowerShell operator -split instead of the string mehtod .split()
'Ahornhof, KG Pradl' -split ','
outputs:
Ahornhof
KG Pradl
… but I doubt that this is what you’re looking for, right?
I could imagine that you’re actually looking for something like this:
$string = @'
Adolf-Kolping-Weg, KG Mühlau (Mühlau-Dorf)
Adolf-Pichler-Platz, KG Innsbruck (Innenstadt)
Ahornhof, KG Pradl
Aldranser Straße, KG Amras
Algunder Straße, KG Amras
'@
$string | ConvertFrom-Csv -Header 'Name', 'Ort'
… outputs this:
Name Ort
---- ---
Adolf-Kolping-Weg KG Mühlau (Mühlau-Dorf)
Adolf-Pichler-Platz KG Innsbruck (Innenstadt)
Ahornhof KG Pradl
Aldranser Straße KG Amras
Algunder Straße KG Amras
If not you may explain more detailed what you’re actually trying to achieve.