Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
if('/' == s.back()) s.pop_back();
p = p.TrimEnd('/');
if (p.endsWith("/")) p = p.substring(0, p.length - 1);
def main(string), do: String.replace_suffix(string, "/", "")
removeTrailingSlash([$/]) -> []; removeTrailingSlash([]) -> []; removeTrailingSlash([Ch | Rest]) -> [Ch] ++ removeTrailingSlash(Rest).
program x character(len=:),allocatable :: string integer :: ii string='my string/' ii=len(string) string=trim(merge(string(:ii-1)//' ',string,string(ii:ii).eq.'/')) write(*,*)string end program x
slashscrape p = if last p == '/' then init p else p
const slashscrape = p => ( p.slice (-1) === '/' ? p.slice (0, -1) : p )
if (p.endsWith("/")) { p = p.substring(0, p.length() - 1); }
p = p.replaceAll("/$", "");
$p = rtrim($p, '/');
var Len: Integer; begin Len := Length(p); if (Len > 0) and (p[Len] = '/') then Delete(P, Len, 1); end;
$p =~ s{/$}{};
p = p.rstrip("/")
p.chomp!("/")
p = p.chomp("/")
if p.ends_with('/') { p.pop(); }
p.stripSuffix("/")