removeTrailingSlash([$/]) -> [];
removeTrailingSlash([]) -> [];
removeTrailingSlash([Ch | Rest]) ->
[Ch] ++ removeTrailingSlash(Rest).
(clojure.string/replace p #"/$" "")
(defn remove-ending-slash
[p]
(if (clojure.string/ends-with? p "/")
(subs p 0 (dec (count p)))
s))
if('/' == s.back())
s.pop_back();
auto p = "no_more_slashes///".stripRight!(a => a == '/');
writeln(p); // no_more_slashes
if (p.endsWith("/")) p = p.substring(0, p.length - 1);
def main(string), do: String.replace_suffix(string, "/", "")
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
p = strings.TrimSuffix(p, "/")
slashscrape p = if last p == '/' then init p else p
const slashscrape = p => (
p.slice (-1) === '/' ?
p.slice (0, -1) :
p
)
p = p.replaceAll("/$", "");
p = p.replaceAll("(?<!^)/+$", "");
int n = p.length() - 1;
if (n != 0 && p.charAt(n) == '/')
p = p.substring(0, n);
if (p.endsWith("/")) {
p = p.substring(0, p.length() - 1);
}
p = string.gsub(p,"/$","")
begin
AllowDirectorySeparators := AllowDirectorySeparators + ['/'];
p := ExcludeTrailingPathDelimiter(p);
end;
var
Len: Integer;
begin
Len := Length(p);
if (Len > 0) and (p[Len] = '/') then Delete(P, Len, 1);
end;
{ local $/='/'; chomp $p }
if p.ends_with('/') { p.pop(); }