Remove slash from url

16/01/2013 13:57

#or there is mutch easiest way to do it with simple :)

$url.TrimEnd('/')

 

function RemoveLastSlashFromUrl($url)

{

      if($url.LastIndexOf("/")+1 -eq $url.Length)

    {

        $newUrl=$url.substring(0, $url.length -1)

    }

    else

    {

        $newUrl = $url

    }

    return $newUrl

}

$url="https://bla/"

RemoveLastSlashFromUrl $url

$url2 ="mycomp"

RemoveLastSlashFromUrl $url2

 

https://bla

mycomp