Smartly joining possibly empty strings I want to join two fragments into one string with a separator, but when one of the fragments is empty I only want one of them.

I have two implementations. The first is long and slightly repetitive, but I believe it is easier to understand, since it is a more step-by-step description of the process. The second is way shorter, but less self-explanatory. It uses the Where method, and it may not be clear to everybody what the semantics of $_ are. Maybe both approaches can even be merged into an even better implementation.

Which would you recommend?

Version 1:

if ($Fragment1.Length -ne 0 -and $Fragment2.Length -ne 0) {
    $String = $Fragment2 + $Seperator + $Fragment2
} elseif ($Fragment1.Length -ne 0) {
    $String = $Fragment1
} elseif ($Fragment2.Length -ne 0) {
    $String = $Fragment2
} else {
    $String = $null
}


Version 2:

$String =
    @($Fragment2, $Fragment1).Where({$_.Length -ne 0}) -join $Seperator
On PowerShell v6+, I would do the following:
$String = $Fragment1, $Fragment2 |
    Where-Object { -not [System.String]::IsNullOrWhiteSpace($_) } |
    Join-String -Separator $Separator

You could use [System.String]::IsNullOrEmpty() instead of [System.String]::IsNullOrWhiteSpace(), but I find [System.String]::IsNullOrWhiteSpace() to be the desired functionality in almost all cases.
On Windows PowerShell (versions prior to v6), the Join-String command doesn't exist. There I would use:
$String = ($Fragment1, $Fragment2 |
    Where-Object { -not [System.String]::IsNullOrWhiteSpace($_) }) -join $Separator

The @().Where({ ... }) method is fairly obscure, so I tend to avoid it.

it may not be clear to everybody what the semantics of $_ are.

I'm not sure it's valuable to consider this possibility. Simply put, if your reader doesn't understand the semantics of $_, then they cannot read PowerShell. It's a ubiquitous and pervasive variable both in practice and in design.