Public/Write-LineBreak.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<#
.SYSNOPSIS
This cmdlet outputs a line seperator to the console.
 
.PARAMETER Title
An optional string of text to embed into the
 
.PARAMETER Length
The lenght of the line. (Default: 70).
#>


function Write-LineBreak([string]$Title = "", [int]$length = 70)
{
    $line = [string]::Join('', [System.Linq.Enumerable]::Repeat('-', $length));
    if (-not [String]::IsNullOrEmpty($Title))
    {
        $line = $line.Insert(4, " $Title ");
        if ($line.Length -gt $length) { $line = $line.Substring(0, $length); }
    }

    Write-Host ''; Write-Host $line; Write-Host '';
}