From ff3289b5e8013ec0a64289966557f530ffbdcb7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 16 May 2017 11:38:28 -0400 Subject: [PATCH] core/text: fix input type in `replace` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/core/text/string_search.nit | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/core/text/string_search.nit b/lib/core/text/string_search.nit index edd90db..6d6302e 100644 --- a/lib/core/text/string_search.nit +++ b/lib/core/text/string_search.nit @@ -470,11 +470,14 @@ redef class Text return res end - # Replace all occurences of `pattern` with `string` + # Replace all occurrences of `pattern` with `string` # - # assert "hlelo".replace("le", "el") == "hello" - # assert "hello".replace('l', "") == "heo" - fun replace(pattern: Pattern, string: SELFTYPE): 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 -- 1.7.9.5