Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #150 Remove trailing slash

Remove the last character from the string p, if this character is a forward slash /

(clojure.string/replace p #"/$" "")

Ensure the regex has a $ at the end!

New implementation...
< >
programming-idioms.org