Replace the first occurrence of pattern with string

assert "hlelo".replace_first("le", "el") == "hello"
assert "hello".replace_first('l', "")    == "helo"

Property definitions

core :: string_search $ Text :: replace_first
	# Replace the first occurrence of `pattern` with `string`
	#
	#     assert "hlelo".replace_first("le", "el") == "hello"
	#     assert "hello".replace_first('l', "")    == "helo"
	fun replace_first(pattern: Pattern, string: Text): String
	do
		return self.split_once_on(pattern).join(string)
	end
lib/core/text/string_search.nit:485,2--492,4