functions/web/Get-ParentUrl.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
function Get-ParentUrl {
    [Cmdletbinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]$Url
    )

    process {
        $Url = $Url.TrimEnd('/')

        $Url.Remove($Url.LastIndexOf('/'), $Url.Length - $Url.LastIndexOf('/'))
    }
}