url - Return string without trailing '/' character -
i having problem in powershell error checking variable trailing slash , removing it. example:
$example1 = 'https://mysite.com/siteone' $example2 = 'https://mysite.com/sitetwo/' how check trailing slash? if script returns $example1, that's fine , script continues. however, if returns $example2 removes trailing slash , makes just:
https://mysite.com/sitetwo
you can trim trailing / characters string.trimend:
ps > $example1 = 'https://mysite.com/siteone' ps > $example1.trimend('/') https://mysite.com/siteone ps > $example2 = 'https://mysite.com/sitetwo/' ps > $example2.trimend('/') https://mysite.com/sitetwo ps > string url powershell
No comments:
Post a Comment