Join-Strings.psm1
function Join-Strings { [CmdletBinding()] [Alias('js')] param( [Parameter(Position = 0, Mandatory, ValueFromPipeline)] [Alias('InputString', 'Strings')] [ValidateNotNull()] [string] $InputObject, [Parameter(Position = 1)] [Alias('JoinCharacter')] [ValidateNotNullOrEmpty()] [string] $Delimeter ) begin { $List = New-Object -TypeName 'System.Collections.Generic.List[string]' } process { [void]$List.Add($_) } end { if ($PSBoundParameters.ContainsKey('Delimeter')) { Write-Output $List -join $Delimeter } else { Write-Output $List -join } } } |