core/text: fix input type in `replace`
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 16 May 2017 15:38:28 +0000 (11:38 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 16 May 2017 16:21:18 +0000 (12:21 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/core/text/string_search.nit

index edd90db..6d6302e 100644 (file)
@@ -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