std.replaceall

STRINGstd.replaceallSTRINGsSTRINGtargetSTRINGreplacement

Available inall subroutines.

Replaces all occurrences of the literal string target in string s with replacement. If no matches are found, no replacements are made. If target is the empty string, the original string s is returned.

Once a replacement is made, substitutions continue from the end of the replaced buffer. Therefore, std.replace("aaa", "a", "aa") will return a string "aaaa" instead of recurring indefinitely.

Example

set req.url = std.replaceall(req.url, "+", "%2520"); # "+" is not a special character