do
return self.split_with(p).join(string)
end
-
- # Escape the four characters `<`, `>`, `&`, and `"` with their html counterpart
- #
- # assert "a&b->\"x\"".html_escape == "a&b->"x""
- fun html_escape: SELFTYPE
- do
- var ret = self
- if ret.chars.has('&') then ret = ret.replace('&', "&")
- if ret.chars.has('<') then ret = ret.replace('<', "<")
- if ret.chars.has('>') then ret = ret.replace('>', ">")
- if ret.chars.has('"') then ret = ret.replace('"', """)
- return ret
- end
end