Replace all occurrences of pattern with string

assert "hlelo".replace("le", "el") == "hello"
assert "hello".replace('l', "")    == "heo"

var t: Text = "hello"
assert t.replace("hello", new FlatBuffer) == ""

Property definitions

core :: string_search $ Text :: replace
	# Replace all occurrences of `pattern` with `string`
	#
	#     assert "hlelo".replace("le", "el") == "hello"
	#     assert "hello".replace('l', "")    == "heo"
	#
	#     var t: Text = "hello"
	#     assert t.replace("hello", new FlatBuffer) == ""
	fun replace(pattern: Pattern, string: Text): String
	do
		return self.split_with(pattern).join(string)
	end
lib/core/text/string_search.nit:473,2--483,4