Available inall subroutines.

Replaces the last occurrence of the string target in string s with replacement if s ends with the target string.

This corresponds to std.suffixof(s, target) returning true. If target is the empty string, the original string s is returned.


# Strip trailing slashes from the request URL
set req.url = std.replace_suffix(req.url, "/", "");

User contributed notes


Do you see an error in this page? Do have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact