Private/_OutSingleStringFromArray.ps1

function _OutSingleStringFromArray {
    [CmdletBinding()]
    [OutputType([String])]
    param (
        [Parameter(Mandatory = $true, ValueFromPipeline)]
        [string[]]$Text,

        [parameter(mandatory = $false)]
        # I wanted to pass a '' so that there was no separator but it still output the object on one line.
        # [char]
        $Separator = ';'
    )
    begin {
        $Output = ''
        $InputObject = @()
    }
    process {
        # This accepts the pipeline input and stores it for processing.
        # It was done this way to get a count of the total number of items submitted in the pipeline.
        foreach ($Item in $Text) {
            $InputObject += $Item
        }
    }
    end {
        # This processes the pipeline input after accepting it all.
        $i = ($InputObject | Measure-Object).count

        foreach ($Item in $InputObject) {
            # The count is 1 higher than the index of the array, decrement before getting an index value.
            $i--
            if ($i -eq 0) {
                $Output += "$Item"
            }
            else {
                $Output += "$Item$Separator "
            }
        }

        $Output
    }
}