From 50961a82cdd857f4429d8bbb71096e5de1a369d0 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 16 May 2013 10:56:25 -0400 Subject: [PATCH] src: change API of split and depreciate split_with Signed-off-by: Jean Privat --- lib/standard/string_search.nit | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/standard/string_search.nit b/lib/standard/string_search.nit index 546fc62..e15740d 100644 --- a/lib/standard/string_search.nit +++ b/lib/standard/string_search.nit @@ -298,9 +298,9 @@ redef class String # a # -> [4, 7] fun search_all(p: Pattern): Array[Match] do return p.search_all_in(self) - # Split self using p is separator. + # Split `self` using `p` as separator. # "hello world".split('o') # -> ["hell", " w", "rld"] - fun split_with(p: Pattern): Array[String] + fun split(p: Pattern): Array[String] do var matches = p.split_in(self) var res = new Array[String].with_capacity(matches.length) @@ -308,9 +308,8 @@ redef class String return res end - # Split self using '\n' is separator. - # "hello\nworld".split # -> ["hello","world"] - fun split: Array[String] do return split_with('\n') + # @deprecated alias for `split` + fun split_with(p: Pattern): Array[String] do return self.split(p) # Replace all occurences of a pattern with a string # -- 1.7.9.5