std.replace_suffix

STRINGstd.replace_suffixSTRINGsSTRINGtargetSTRINGreplacement

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.

Example

std.replace_suffix("https://www.example.com/", "/", "") # returns "https://www.example.com"