I have a function which returns PSCustomObject, like this:
Function Get-Data {
# ...
[PSCustomObject]@{
Url = $Url
Id = $Id
}
}
Later on, I call this function like this:
$data = Get-Data
And then I'd like to output formatted string including property values of that object. The closest result to what I want is output with the line below:
Write-Host "$($data.Url)|$($data.Id)|OK"
The problem is a whitespace after the first |
character.
Where does it come from? How to get rid of it the proper way?