18 July 2015

Remove empty entries from split array


$a = 'Surname        GivenName1  GivenName2'
$a = $a.Split(' ',[System.StringSplitOptions]::RemoveEmptyEntries) -join ' '

result: 'Surname GivenName1 GivenName2'

No comments:

Post a Comment